Opened 5 hours ago
Last modified 4 hours ago
#11317 open defect
Can AVCodec provide more crop information when decoding via MediaCodec?
Reported by: | lanczos-algorithm | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | mediacodec |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I'm using an Android single-board computer based on Allwinner H618 to decode RTP stream and display it. When decoding a video stream using FFMPEG with HW MediaCodec, the frame parameters change from 1280x720 to 1280x736 at startup without any action on my part:
07-06 09:59:28.814 2158 2199 D SurfaceUtils: disconnecting from surface 0xee2fac08, reason setNativeWindowSizeFormatAndUsage 07-06 09:59:28.815 2158 2199 D SurfaceUtils: connecting to surface 0xee2fac08, reason setNativeWindowSizeFormatAndUsage 07-06 09:59:28.815 2158 2199 D SurfaceUtils: set up nativeWindow 0xee2fac08 for 1280x736, color 0x32315659, rotation 0, usage 0x402d00 07-06 09:59:28.876 2158 2204 D MyApp: FFmpeg: [h264_mediacodec @ 0xc7962500] Output MediaFormat changed to {crop-right=1279, color-format=842094169, slice-height=720, mime=video/raw, hdr-static-info=java.nio.HeapByteBuffer[pos=0 lim=25 cap=25], stride=1280, color-standard=1, color-transfer=3, crop-bottom=719, crop-left=0, width=1280, color-range=2, crop-top=0, height=736} 07-06 09:59:28.876 2158 2204 D MyApp: 07-06 09:59:28.877 2158 2204 D MyApp: FFmpeg: [h264_mediacodec @ 0xc7962500] Output crop parameters top=0 bottom=719 left=0 right=1279, resulting dimensions width=1280 height=720 07-06 09:59:28.877 2158 2204 D MyApp:
Apparently, to align the dimensions to 32 pixels. The avcodec_receive_frame
writes width, height = 1280x720 to AVFrame
and as a result, libraries that use AVCodec incorrectly determine the correct texture size, because in the frame itself there is no information about 736 anywhere. Without any additional workarounds I get a green line at the bottom
Attachments (3)
Change History (5)
by , 5 hours ago
by , 4 hours ago
Attachment: | photo-2024-11-21t13-15-34-662.png added |
---|
comment:1 by , 4 hours ago
Keywords: | hwaccel added |
---|---|
Version: | unspecified → 7.1 |
by , 4 hours ago
Attachment: | 0001-avcodec-mediacodecdec_common-export-correct-dimensio.patch added |
---|
comment:2 by , 4 hours ago
Keywords: | crop hwaccel removed |
---|---|
Status: | new → open |
Version: | 7.1 → git-master |
Could you test the (Untested as i don't have the hardware for this) attached patch?
PoC fix