#11010(avcodec:new): Android MediaCodec: encoding videos with resolution not divisible by 16 to codec other than H.264 and H.265
#11010: Android MediaCodec: encoding videos with resolution not divisible by 16 to codec other than H.264 and H.265 -----------------------------------+--------------------------------------- Reporter: antonlyap | Type: enhancement Status: new | Priority: normal Component: avcodec | Version: git-master Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -----------------------------------+--------------------------------------- Current behavior: When trying to encode a video with a resolution not divisible by 16 (e.g. 1080p) with Android MediaCodec, the resolution is aligned to 16 pixels (1920x1088). If the output is H.264 or H.265, this gets mitigated by cropping the stream with `h264_metadata` or `hevc_metadata` BSF. How to reproduce: {{{ % ffmpeg -i input.mkv -c:v vp9_mediacodec -b:v 4000k -c:a copy out.mkv # input.mkv is a 1080p video % ffprobe out.mkv # displays 1920x1088 }}} Proposed enhancement: There are other methods to make sure that the output is 1920x1080 instead of 1920x1088: - setting `crop-bottom` (and `crop-right`) on `MediaFormat` (https://developer.android.com/reference/android/media/MediaFormat#KEY_CROP_B...). Unfortunately, it's only supported on API level 33+ - allowing the user to opt out of the alignment, as a lot of hardware can produce 1080p (or possibly other arbitrary resolution) output. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11010> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11010: Android MediaCodec: encoding videos with resolution not divisible by 16 to codec other than H.264 and H.265 -------------------------------------+----------------------------------- Reporter: antonlyap | Owner: (none) Type: enhancement | Status: new Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Comment (by antonlyap): Also, it appears that we can get accurate info on alignment requirements on API 21+: https://developer.android.com/reference/android/media/MediaCodecInfo.VideoCa...) -- Ticket URL: <https://trac.ffmpeg.org/ticket/11010#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11010: Android MediaCodec: encoding videos with resolution not divisible by 16 to codec other than H.264 and H.265 -------------------------------------+----------------------------------- Reporter: antonlyap | Owner: (none) Type: enhancement | Status: new Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Comment (by quinkblack): Replying to [comment:1 antonlyap]:
Also, it appears that we can get accurate info on alignment requirements on API 21+: https://developer.android.com/reference/android/media/MediaCodecInfo.VideoCa...)
Firstly, it's only available with the terrible designed Java API. Seconly, the information provided by this API on a lot of devides are incorrect, so it's not helpful if it's not reliable. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11010#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11010: Android MediaCodec: encoding videos with resolution not divisible by 16 to codec other than H.264 and H.265 -------------------------------------+----------------------------------- Reporter: antonlyap | Owner: (none) Type: enhancement | Status: closed Priority: normal | Component: avcodec Version: git-master | Resolution: fixed Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Changes (by quinkblack): * status: new => closed * resolution: => fixed Comment: Fixed by 2a68b2d643f7b725defa9bec5174853a00411b98 and 7d46ab9e1206b09ebe1a94ecac49cc99d9b3522e -- Ticket URL: <https://trac.ffmpeg.org/ticket/11010#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg