[FFmpeg-user] Detelecine: I got the right result from the wrong command?

Alex Xu alexkurosakimh3 at gmail.com
Thu May 29 04:27:41 EEST 2025


I got those "unnecessary" args from
https://trac.ffmpeg.org/wiki/Encode/YouTube They aren't important.

I think you might be mistaking CRF for CFR (constant frame rate). CRF is a
measure of compression, it shouldn't drop and duplicate frames. frames.
https://trac.ffmpeg.org/wiki/Encode/H.264#a1.ChooseaCRFvalue

Anyways, in summary, here are commands with unnecessary args removed:

My working command using detelecine (from prior message in thread with
start_frame=3, pattern=2332), simplified:

ffmpeg -i detelecine_input.mkv -c:v libx264 -c:a aac -vf
"detelecine=start_frame=3:pattern=2332,drawtext=fontfile=Arial.ttf:
text='%{frame_num}': start_number=0: x=(w-tw)/2: y=h-(2*lh):
fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5"
 detelecine_2332_simplified.mkv;

(And my original question was why pattern=2332 was correct, since the
pattern is visually to me just 23.)

All my attempts to use fieldmatch+decimate causes frame 173 to be dropped
and 174 to be duplicated.

Example not working fieldmatch+decimate:

ffmpeg -i detelecine_input.mkv -vf
"fieldmatch,decimate,drawtext=fontfile=Arial.ttf: text='%{frame_num}':
start_number=0: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20:
box=1: boxcolor=white: boxborderw=5" -c:v libx264 -c:a aac
 fieldmatch_decimate_simple.mkv

And this was original source if you want to try yourself (12 MB, first 32
seconds truncated):
https://www.mediafire.com/file/x4ly6moqb8ayfyy/detelecine_input.mkv/file





On Wed, May 28, 2025 at 5:47 PM Mark Filipak <markfilipak.imdb at gmail.com>
wrote:

> On 28/05/2025 19.18, Alex Xu wrote:
> > Anyways, I tried:
> >
> > ffmpeg -i detelecine_input.mkv -vf
> > "fieldmatch,decimate,drawtext=fontfile=Arial.ttf: text='%{frame_num}':
> > start_number=0: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20:
> > box=1: boxcolor=white: boxborderw=5" -c:v libx264 -crf 18 -c:a aac -b:a
> > 192k -pix_fmt yuv420p fieldmatch_decimate_only_no_r.mkv
> >
> > the issue of duplicated frames 174+175 and skipped 173.
>
> So, frame 173 was dropped, and frame 174 was repeated. I think that may
> have resulted from "-crf 18".
>
> > In case you missed it, my test file was in the first message of the
> chain.
> > And using the detelecine filter got me the right result (with wrong
> params?)
>
> Yes, the 'detelecine' filter will give you correct results for video
> that's been statically and
> correctly telecined: no variations, clean joins of the VOBs, if
> applicable. But
> 'fieldmatch'+'decimate' can be configured exactly that way. In contrast
> 'fieldmatch' is a lot smarter.
>
> I hope you don't mind that I reformatted your commands.
>
> for i in 0 1 2 3 4; do
> for j in 23 2332; do
> ffmpeg^
>   -i detelecine_input.mkv^
>   -c:v libx264^
>   -crf 18^           <== trouble?
>   -c:a aac^
>   -b:a 192k^         <== why?
>   -pix_fmt yuv420p^  <== unnecessary
>   -vf^
>   "detelecine=start_frame=$i:pattern=$j"
>   $i$j.mkv;
> done
> done
>
> I see what you're doing. By the way, which $i$j.mkv was the best?
>
> Your latest:
>
> set _DETELECINE_=fieldmatch,decimate
> set _SHOW_N_=drawtext=fontfile=Arial.ttf^
> :text='%{frame_num}'^
> :start_number=0^
> :x=(w-tw)/2:y=h-(2*lh)^
> :fontcolor=black:fontsize=20^
> :box=1:boxcolor=white:boxborderw=5
> ffmpeg^
>   -i detelecine_input.mkv^
>   -vf^
>   "%_DETELECINE_%,%_SHOW_N_%"^
>   -c:v libx264^
>   -crf 18^           <== trouble?
>   -c:a aac^
>   -b:a 192k^         <== why?
>   -pix_fmt yuv420p^  <== unnecessary
>   fieldmatch_decimate_only_no_r.mkv
>
> By the way, I send about 30 options directly to x264 via '-x264-params',
> none of which is 'crf'. My
> videos are the highest quality and the smallest files ever.
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list