[FFmpeg-user] repeat a frame

Mark Filipak (ffmpeg) markfilipak at bog.us
Fri Mar 5 00:42:49 EET 2021

On 2021-03-04 09:36, Michael Koch wrote:
> Am 03.03.2021 um 23:57 schrieb Mark Filipak (ffmpeg):
>> I've tried transcoding a 2:21:19 movie via this script:
>> SET prep23=settb=expr=1/720000,setpts=N*30030
>> SET cfr23=setpts=N*1001/24000/TB,fps=24000/1001
>> SET codecs=-codec:v libx265 -x265-params crf=16:qcomp=1.00 -codec:a copy -codec:s copy -dn
>> ffmpeg -i i:\BDMV\STREAM\00303.m2ts -vf %prep23%,%cfr23% %codecs% test.mkv
> Isn't the first setpts filter useless, because it's overwritten by the second setpts filter?

Not useless.

The 'TB' set by 'prep23' produces 'PTS's based on it -- 'PTS' is a function of 'TB' & 'N'. If the 
'TB' in that function doesn't have enough resolution to produce valid 'PTS's throughout the video, 
if it gets truncated in some internal step, then for those 'PTS's toward the end of the video, 
frames will have bogus 'PTS's and will be dropped. On the other hand, if all is well within the 
filter pipeline and 'TB' is not truncated in some internal step, then, Yes, the test seems 
superfluous. My command line determines which of those is the case.

If the output, 'test.mkv', wound up shortened (due to dropped frames), then I could conclude that 
calculations that included 'TB' got truncated in some internal step. Essentially, what I did was 
indirectly test the resolution of 'TB'.

More information about the ffmpeg-user mailing list