[FFmpeg-trac] #11010(avcodec:new): Android MediaCodec: encoding videos with resolution not divisible by 16 to codec other than H.264 and H.265

FFmpeg trac at avcodec.org
Sat May 11 23:11:31 EEST 2024


#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_BOTTOM).
 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


More information about the FFmpeg-trac mailing list