arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.3k stars 580 forks source link

configureCodec returning error -61 #987

Open openXu opened 3 months ago

openXu commented 3 months ago

Description

When transcoding a video to h264 format, The Android platform always fails, It was successful on iOS.

String cmd = " -i /data/user/0/cn.xxx.xxx/files/program/res/VID_20240506_150725_1716654064425_0.mp4 -acodec aac -vcodec h264 -s 1280x720 -y /data/user/0/cn.xxx.xxx/cache/video_transcode/56ea85f727c6525dc498fc6d23a3286b_convert.mp4";

FFmpegSession session = await FFmpegKit.execute(cmd);
    print('----------cmd:  $cmd');
    ReturnCode? returnCode = await session.getReturnCode();
    if (ReturnCode.isSuccess(returnCode)) {
      print('---------- success  $returnCode');
      File outTempFile = File(outTempFilePath);
      if (outTempFile.existsSync()) {
        outTempFile.renameSync(outFilePath);
      }
    } else if (ReturnCode.isCancel(returnCode)) {
    } else {
      print('---------- failed $returnCode');
      final failStackTrace = await session.getFailStackTrace();
      print('---------- failStackTrace $failStackTrace');
    }

The log is as follows:

企业微信截图_17168089503019

Logs

I/flutter (21572): Loading ffmpeg-kit-flutter.
D/ffmpeg-kit-flutter(21572): FFmpegKitFlutterPlugin stopped listening to events.
D/ffmpeg-kit-flutter(21572): FFmpegKitFlutterPlugin com.arthenica.ffmpegkit.flutter.FFmpegKitFlutterPlugin@7596574 started listening to events on io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation@fed9761.
I/flutter (21572): Loaded ffmpeg-kit-flutter-android-full-gpl-arm64-v8a-6.0.3.
I/flutter (21572): ------------- {color_range: pc, pix_fmt: yuvj420p, r_frame_rate: 30/1, start_pts: 0, extradata_size: 35, duration_ts: 1384132, duration: 15.379244, bit_rate: 20003595, sample_aspect_ratio: 1:1, field_order: progressive, film_grain: 0, is_avc: true, codec_tag_string: avc1, avg_frame_rate: 10350000/346033, closed_captions: 0, id: 0x1, color_space: smpte170m, nb_frames: 460, codec_long_name: unknown, height: 1080, color_primaries: smpte170m, nal_length_size: 4, chroma_location: left, time_base: 1/90000, coded_height: 1080, level: 40, color_transfer: smpte170m, profile: 100, bits_per_raw_sample: 8, index: 0, codec_name: h264, tags: {creation_time: 2024-05-06T07:07:43.000000Z, handler_name: VideoHandle, vendor_id: [0][0][0][0], language: eng}, start_time: 0.000000, disposition: {metadata: 0, original: 0, visual_impaired: 0, forced: 0, attached_pic: 0, still_image: 0, descriptions: 0, captions: 0, dub: 0, karaoke: 0, default: 1, timed_thumbnails: 0, comment: 0, hearing_impaired: 0, lyrics: 0, dependent: 0, clean_e
I/flutter (21572): ---------- frameNumber: 460 oldCode: h264 width: 1920 height: 1080 colorSpace: smpte170m colorTransfer: smpte170m bits: 8
I/flutter (21572): ---------- newWidth 1280 newHeight 720
D/        (21572): PlayerBase::stop() from IPlayer
D/AudioTrack(21572): stop() called with 734976 frames delivered
I/flutter (21572): media_kit: wakelock: _count = 0
I/OMXClient(21572): IOmx service obtained
I/ExtendedACodec(21572): setupVideoDecoder()
I/ExtendedACodec(21572): Decoder will be in frame by frame mode
I/OMXClient(21572): IOmx service obtained
D/ACodec  (21572): get packages (cn.huidu.hdlcdapp) for calling UID 10304
I/ExtendedACodec(21572): setupVideoEncoder()
W/OMXUtils(21572): do not know color format 0x7fa30c04 = 2141391876
W/OMXUtils(21572): do not know color format 0x7f000789 = 2130708361
E/ACodec  (21572): [OMX.qcom.video.encoder.avc] does not support color format 19
E/ExtendedACodec(21572): [OMX.qcom.video.encoder.avc] configureCodec returning error -61
E/ACodec  (21572): signalError(omxError 0x80001001, internalError -61)
E/MediaCodec(21572): Codec reported err 0xffffffc3, actionCode 0, while in state 3
E/ACodec  (21572): [OMX.qcom.video.encoder.avc] configureCodec returning error -61
E/ACodec  (21572): signalError(omxError 0x80001001, internalError -61)
E/MediaCodec(21572): Codec reported err 0xffffffc3, actionCode 0, while in state 0
E/MediaCodec(21572): configure failed with err 0xffffffc3, resetting...
I/OMXClient(21572): IOmx service obtained
I/flutter (21572): ----------cmd:  -i /data/user/0/cn.xxx.xxx/files/program/res/VID_20240506_150725_1716654064425_0.mp4 -acodec aac -vcodec h264 -s 1280x720 -y /data/user/0/cn.xxx.xxx/cache/video_transcode/56ea85f727c6525dc498fc6d23a3286b_convert.mp4
I/flutter (21572): ---------- failed 1
I/flutter (21572): ---------- failStackTrace null

Environment

Flutter 3.19.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 300451adae (9 weeks ago) • 2024-03-27 21:54:07 -0500 Engine • revision e76c956498 Tools • Dart 3.3.3 • DevTools 2.31.1

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

tanersener commented 1 month ago

Check session.getOuput() please!