[FFmpeg-devel] [PATCH] avformat/yuv4mpegenc: simplify writing the header

James Almer jamrial at gmail.com
Thu Sep 10 03:00:18 EEST 2020


On 9/9/2020 7:54 PM, Michael Niedermayer wrote:
> On Thu, Sep 03, 2020 at 03:55:04PM -0300, James Almer wrote:
>> Actually write it in yuv4_write_header() instead of with the first
>> packet.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavformat/yuv4mpegenc.c | 35 ++++++++++++++---------------------
>>  1 file changed, 14 insertions(+), 21 deletions(-)
> 
> This changes the written header
> for example:
> ./ffmpeg  -i ~/tickets/2190/clip.yuv -bitexact testbad.y4m
> 
> YUV4MPEG2 W720 H480 F30000:1001 Ip A10:11 C411 XYSCSS=411
> vs
> YUV4MPEG2 W720 H480 F30000:1001 Ib A10:11 C411 XYSCSS=411

If I'm reading this right, ffmpeg.c changes the output AVCodecParameters
struct (In this case, field_order) after calling avformat_write_header()
but before writing a packet, which is wrong.

We could revert this change (And the one by Andreas that came after it),
but perhaps ffmpeg.c should be fixed to not violate the API instead.


More information about the ffmpeg-devel mailing list