Opened 3 weeks ago

Last modified 6 days ago

#11368 new defect

Mediacodec encoding not working

Reported by: RandomPerson Owned by:
Priority: normal Component: ffmpeg
Version: 7.1 Keywords:
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

% ffmpeg -i video_input -c:v hevc_mediacodec output_video
ffmpeg version 7.1
built on r522817c) clang version 18.0.3 (https://android.googlesource.com/toolchain/llvm-project d8003a456d14a3deb8054cdaa529ffbf02d9b262)

Encoding with mediacodec is the problem, decoding works just fine

Attachments (3)

ffmpeg-log-part-1.log (1.9 MB ) - added by RandomPerson 3 weeks ago.
ffmpeg-log-part-2.log (1.9 MB ) - added by RandomPerson 3 weeks ago.
ffmpeg-log-part-3.log (1.8 MB ) - added by RandomPerson 3 weeks ago.

Change History (9)

by RandomPerson, 3 weeks ago

Attachment: ffmpeg-log-part-1.log added

by RandomPerson, 3 weeks ago

Attachment: ffmpeg-log-part-2.log added

by RandomPerson, 3 weeks ago

Attachment: ffmpeg-log-part-3.log added

comment:1 by MasterQuestionable, 3 weeks ago

Cc: MasterQuestionable added

͏    Simple description of the exact problem? (what failed exactly)
͏    Parsing your huge log wouldn't be enjoyable...

in reply to:  1 comment:2 by RandomPerson, 3 weeks ago

Replying to MasterQuestionable:

͏    Simple description of the exact problem? (what failed exactly)
͏    Parsing your huge log wouldn't be enjoyable...

So mediacodec encoding just does not work, reaches EOF before even starting according to ffmpeg and exits with a very large negative exit code, no output stream either

Version 0, edited 3 weeks ago by RandomPerson (next)

comment:3 by RandomPerson, 3 weeks ago

So I was wrong about the exit code it seems like

This is the default output when starting

[vost#0:0/hevc_mediacodec @ 0x7f39e7b600] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height. [vf#0:0 @ 0x7f39ea24c0] Error sending frames to consumers: Bitstream filter not found [vf#0:0 @ 0x7f39ea24c0] Task finished with error code: -1179861752 (Bitstream filter not found) [vf#0:0 @ 0x7f39ea24c0] Terminating thread with return code -1179861752 (Bitstream filter not found) [vost#0:0/hevc_mediacodec @ 0x7f39e7b600] Could not open encoder before EOF [vost#0:0/hevc_mediacodec @ 0x7f39e7b600] Task finished with error code: -22 (Invalid argument) [vost#0:0/hevc_mediacodec @ 0x7f39e7b600] Terminating thread with return code -22 (Invalid argument) [out#0/mp4 @ 0x7f39e06cc0] Nothing was written into output file, because at least one of its streams received no packets. frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A Conversion failed!

comment:4 by quinkblack, 7 days ago

I guess this is the issue fixed by 4c0ef3bfae1473902f8ec8ee0a1a95607827b390, which is on branch the 7.1 branch and master branch, but not released in a new tag yet. Can you test the master branch? Or check whether specify a resolution which isn't aligned to 16 work, like:

ffmpeg -i video_input -c:v hevc_mediacodec -s 1920x1080 output_video

comment:5 by RandomPerson, 7 days ago

Yeah it's gone further than last time buuuuuut it's stuck

Output #0, mp4, to '../test.mp4':

Metadata: COMPATIBLE_BRANDS: iso6avc1mp41 MAJOR_BRAND : dash

MINOR_VERSION : 0 encoder : Lavf61.9.104

Stream #0:0, 0, 1/30000: Video: hevc, 1 reference frame (hev1 / 0x31766568), yuv420p(tv, smpte170m/bt470bg/bt709, progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, q=2-31, 200 kb/s, 29.97 fps, 30k tbn (default)

Metadata:

encoder : Lavc61.29.100 hevc_mediacodec HANDLER_NAME : ISO Media file produced by Google Inc. VENDOR_ID : [0][0][0][0] DURATION : 00:01:05.098000000 Stream #0:1(eng), 0, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)

Metadata:

encoder : Lavc61.29.100 aac DURATION : 00:01:05.108000000 [out#0/mp4 @ 0x7dca435f00] Starting thread... [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.0333667 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.0333667 queue head -1 ts N/A [vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.010979 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.0667333

[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.0667333 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.1001 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.1001 queue head -1 ts N/A [vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.002983 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.133467
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.133467 queue head -1 ts N/A [vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.013969 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.166833
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.166833 queue head -1 ts N/A [h264 @ 0x7dca43d300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.2002
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.2002 queue head -1 ts N/A [vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.005974 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.233567
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.233567 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.266933 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.266933 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.3003
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.3003 queue head -1 ts N/A
[vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.008995 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.333667
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.333667 queue head -1 ts N/A
[h264 @ 0x7dca43d680] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 0x7dca43da00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
[h264 @ 0x7dca43dd80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 0x7dca43e100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.367033 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.367033 queue head -1 ts N/A
[h264 @ 0x7dca43e480] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 0x7dca43e800] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 0x7dca43eb80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1 [h264 @ 0x7dca43cf80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0 [h264 @ 0x7dca43d300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 0.9005 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 0.881667 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 0.9205 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 0.903 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 0.9405
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 0.924333 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 0.9605
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 0.945667 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 0.9805
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 0.967 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.0005 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 0.988333 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.0205 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.009667 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.0405
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.031 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.0605 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.052333 queue head -1 ts N/A [vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.000999 [h264 @ 0x7dca43d680] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0 [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.0805 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.073667 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.1005
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.095 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.1205
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.116333 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.1405 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.137667 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.1605 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.159 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.1805 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.180333 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.2005
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.2205 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.201667 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.2405
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.223 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.4004 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.4004 queue head -1 ts N/A [vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.011986
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.433767 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.433767 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.467133
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.467133 queue head -1 ts N/A
[vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.003990
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.5005 [h264 @ 0x7dca43da00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0 [h264 @ 0x7dca43dd80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1 [h264 @ 0x7dca43e100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.5005 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.2605 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.244333 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.2805 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.265667 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.3005 [out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.287 queue head -1 ts N/A [h264 @ 0x7dca43e480] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0 [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.3205
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.308333 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 1 ts 1.3405
[out#0/mp4 @ 0x7dca435f00] sq: receive 1 ts 1.329667 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.533867 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.533867 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.567233
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.567233 queue head -1 ts N/A
[vf#0:0 @ 0x7dca6126c0] Clipping frame in rate conversion by 0.006981 [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.6006
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.6006 queue head -1 ts N/A
[out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.633967 [out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.633967 queue head -1 ts N/A [out#0/mp4 @ 0x7dca435f00] sq: send 0 ts 0.667333
[out#0/mp4 @ 0x7dca435f00] sq: receive 0 ts 0.667333 queue head -1 ts N/A
[h264 @ 0x7dca43e800] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 0x7dca43eb80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 0x7dca43cf80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1 [h264 @ 0x7dca43d300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0 frame= 0 fps=0.0 q=0.0 size= 0KiB time=N/A bitrframe= 0 fps=0.0 q=0.0 size= 0KiB time=N/A bitrframe= 0 fps=0.0 q=0.0 size= 0KiB time=N/A bitrframe= 0 fps=0.0 q=0.0 size= 0KiB time=N/A bitrframe= 0

in reply to:  5 comment:6 by quinkblack, 6 days ago

Replying to RandomPerson:

Yeah it's gone further than last time buuuuuut it's stuck

What's the Android OS version? Is it Android 15? Google break mediacodec decoding/encoding without JVM on Android 15, ref. https://trac.ffmpeg.org/ticket/11363

Note: See TracTickets for help on using tickets.