[FFmpeg-devel] [PATCH] lavfi/vf_decimate: add mixed option to process input only partially to be decimated

Paul B Mahol onemda at gmail.com
Mon Dec 19 17:27:00 EET 2022

On 11/9/22, mail at nodoa.me <mail at nodoa.me> wrote:
> The purpose of this new option is to enable processing of mixed content
> such
> as TV recordings or even movies which have some cuts in telecined 24fps and
> others in 30p.
> Enabling it (mixed=1) will calculate a common timebase between decimated
> and
> non-decimated content and set frame duration according to whether the
> current cycle contains a frame deemed to be a duplicate or not.
> The default is disabled (mixed=0) and keeping it disabled will keep the PTS
> as before (verified using ffprobe).
> Regarding setting frame->pts, I had to adjust this part a bit as it is no
> longer possible to assume all frames counted by frame_count_in have the
> same
> duration.
> As for outlink->frame_rate, I have removed the assignment in the case of
> mixed content as the output will be of variable frame rate. Please tell me
> in case this is not sufficient to signalize VFR content.
> An example for verifying the result is
> http://samples.ffmpeg.org/HDTV/Hellboy.ts
> ffmpeg -i Hellboy.ts -map 0:v -c:v libx264 -vf
> fps=fps=30000/1001,fieldmatch,decimate=mixed=1,fps=fps=120000/1001 -preset
> veryfast -crf 10 Hellboy.mp4
> The source has a frame rate of 30000/1001 -> timebase 1001/30000 which with
> a decimation cycle of 5 results in a decimated timebase of 24000/1001 and a
> common timebase of 1001/120000.
> The source contains 24fps interlaced content which will result in a
> duration
> of 5 frames at the output frame rate of 120000/1001.
> The source also contains 30p content which in the output will have a
> duration of 4 frames.
> This particular source requires the frame rate to be set to constant
> 30000/1001. I haven't looked into why but I have verified this to also be
> required if not applying this patch.


More information about the ffmpeg-devel mailing list