[FFmpeg-devel] [PATCH v3 3/7] avcodec/mediacodecenc: use bsf to handle crop

"zhilizhao(赵志立)" quinkblack at foxmail.com
Tue Dec 13 05:20:23 EET 2022



> On Dec 12, 2022, at 23:27, Tomas Härdin <git at haerdin.se> wrote:
> 
> lör 2022-12-10 klockan 01:22 +0800 skrev Zhao Zhili:
>> From: Zhao Zhili <zhilizhao at tencent.com>
>> 
>> It's well known that mediacodec encoder requires 16x16 alignment.
>> Use our bsf to fix the crop info.
>> ---
>> v3: don't change the dimension for AV_PIX_FMT_MEDIACODEC. It can have
>> side effect.
> 
> Looks like this silently crops? Is that really a good idea? We usually
> don't do stuff like that. For example codecs that require even
> dimensions complain loudly then fail.

It’s reasonable to require even dimensions. Require dimensions aligned
to 16 is uncommon. Everyone will complain why 1080x1920 doesn’t work.

A lot of apps just use aligned dimensions. Users have no control on
these apps. It’s not the same with FFmpeg, users (developer or not)
can specify the dimension directly.

If we don’t fix it, either:

1. Reject and fail directly. User complain why.
2. Accept and keep going. Sometimes it works, sometimes don’t. It
depends on the device and get into a confused situation.

I know there are getWidthAlignment()/getHeightAlignment() to get
alignment info of codecs. The results are unreliable. The only
reliable way I can find is don’t depends on those API and fix it
by ourself.

I’d like to know if there are better choices.

> 
> /Tomas
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list