[FFmpeg-devel] yadif frame doubling - incorrect closed captioning

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Jan 14 13:28:27 EET 2019


2019-01-14 9:31 GMT+01:00, Michael Niedermayer <michael at niedermayer.cc>:
> On Sun, Jan 13, 2019 at 05:26:49PM -0500, Gabriel Blanchard wrote:
>> When frame doubling using yadif/bwdif closed captioning gets copied to
>> the
>> second frame - as a result the closed captioning text is garbage.
>>
>> I've attached a very simple patch that fixes this issue. Very similar to
>> what vf_fps.c already does around line 253.
>>
>> -Gabe
>
>>  yadif_common.c |    3 +++
>>  1 file changed, 3 insertions(+)
>> b01ce870aa048fbe25c6ae69ec1b611d6a782865
>> 0001-fix-closed-captioning-when-frame-doubling.patch
>> From 0f6d3c31842ae33eaa3d5d91600bcd80c9c0a6b9 Mon Sep 17 00:00:00 2001
>> From: Gabriel Blanchard <gblanchard at start.ca>
>> Date: Sun, 13 Jan 2019 17:10:01 -0500
>> Subject: [PATCH 1/1] fix closed captioning when frame doubling
>>
>> ---
>>  libavfilter/yadif_common.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/libavfilter/yadif_common.c b/libavfilter/yadif_common.c
>> index a10cf7a17f..fbb4289b80 100644
>> --- a/libavfilter/yadif_common.c
>> +++ b/libavfilter/yadif_common.c
>> @@ -43,6 +43,9 @@ static int return_frame(AVFilterContext *ctx, int
>> is_second)
>>              return AVERROR(ENOMEM);
>>
>>          av_frame_copy_props(yadif->out, yadif->cur);
>> +        // Don't copy Closed Captioning
>> +        av_frame_remove_side_data(yadif->out, AV_FRAME_DATA_A53_CC);
>
> This also applies to AV_FRAME_DATA_MOTION_VECTORS which
> too become invalid on a duplicated frame

> Thus a new function should be added which does all this, and that then
> be used

Could you explain?
I first thought that you mean a function "remove a particular kind of
side data" but that already exists.
Do you mean a new function that exactly removes the kind of side
data that we decide in advance should always be removed from
duplicated frames? Will this be correct for all use cases? (I don't
doubt it, just asking.)

Carl Eugen


More information about the ffmpeg-devel mailing list