[FFmpeg-devel] [PATCH] avcodec/mediacodecenc: Extract configOBUs from AV1CodecConfigurationRecord
Martin Storsjö
martin at martin.st
Sat Oct 5 00:01:32 EEST 2024
On Sat, 5 Oct 2024, Zhao Zhili wrote:
> From: Zhao Zhili <zhilizhao at tencent.com>
>
> MediaCodec can generate AV1CodecConfigurationRecord, which shouldn't
> be put into packet->data. Skip four bytes and extract configOBUs
> if it exist.
> ---
> I did some test on Pixel 8 Pro. AV1 hardware encoding works with a lot
> of bugs:
>
> 1. It's broken for width non-aligned to 16. For width 1080 and pixel
> format YUV420P, MediaCodec use 1080 as stride. For pixel format NV12,
> MediaCodec use 1088 as stride. There is no API to get the stride info.
> AMEDIAFORMAT_KEY_STRIDE doesn't work. And set stride to MediaCodec has
> no effect from my test, at least on that device. We know the buffer
> size provided by MediaCodec, but we still cannot get stride by
> buf_size / height:
>
> 1) For YUV420P, buf_size = 1080 * height
> 2) For NV12, buf_size = 1080 + 1088 * (height - 1). Yes, buf_size doesn't
> count last line's padding :(
Isn't this pretty much the case for the encoders for other codecs as well
- there aren't really any compat guarantees for how they behave for widths
that aren't a multiple of 16? At least back when there when Android added
CTS tests to guarantee some sort of cross device consistent behaviour,
they only tested/mandated the behviour for a couple resolutions, that all
were even multiples of 16.
I guess the difference here is whether it's possible to do cropping in the
same way as via the h264_metadata/hevc_metadata BSFs?
// Martin
More information about the ffmpeg-devel
mailing list