My query is in relation to the ffmpeg Telecine syntax and IVTC.
I live in PAL land so while I don't have a pressing need to get this right I would really like to clarify my understanding specifically about the Telecine output. Any help would be greatly appreciated, thanks.
Issue: My telecined output is always progressive, I thought it should be interlaced. Source test clip is 24p.
Maybe it is the case that the Telecine command is doing it correctly, i.e. when I run IVTC on the progressive (30fps) telecined clip it outputs a 24P file identical to the original.
I use this ffmpeg syntax below to apply IVTC to a Telecined video file ... Some batch file variables used here.
ffmpeg -i "%~n1%~x1" -vf fieldmatch=order=%_FIELD_ORDER%:combmatch=full,yad if=deint=interlaced,decimate -c:v libx264 -crf %_QUALITY% %_AUDIO% "%~n1-[IVTC]%_EXTN%"
No problem with that I think! So I need to test the ITVC above on an actual telecined 29.97.30 fps clip, but I don't have a sample clip.
Therefore I needed to create a sample telecined clip using ffmpeg's telecine.
My mis-understanding ? is with creating the Telecined video file to test, I don't actually have a sample 29.97 fps clip.
My plan was to create a telecined interlaced output (30 fps) from a 24 fps Progressive input.
So I used the following telecine ffmpeg syntax ... Input file is a 5 second SOOC 24 fps progressive FHD clip
ffmpeg -y -i "%~n1%~x1" -vf "telecine=top:2332" -c:v libx264 -crf 17 "%~n1-[TCNE].mov"
So, my mis-undestanding ? is that I expected that the telecined output would need to be interlaced, but it always comes out as progressive/unknown field order.
Everything appears ok, that is 24p to 30p to 24p, except I thought that the 30p should be interlaced.
I am aware that all of this can be done in Handbrake etc, I just like to have a go myself.
The yadif above, is for some reason seperated, yad if, but it's actually not in syntax.
+ Reply to Thread
Results 1 to 17 of 17
-
Last edited by JN-; 8th Jun 2022 at 15:58.
-
You have to tell libx264 to encode mbaff instead of progressive, and the field order
eg. add
Code:x264opts tff=1
-
Thank you so much poisondeathray
. That works and the two 24p files are identical in output, so my IVTC util appears to be ok.
Mediainfo reports the 30fps clip as interleaved, not interlaced. Does that matter? Field order unknown.
My interest in having it interlaced is that using ffprobe I can detect the incoming field order in the 30 fps fiel and set my ITVC util to top or bottom accordingly.
The interleaved file doesn't have that, because it's not interlaced. So I will accept that in most cases input would be tff.
Thanks again, very much appreciated. I spent the last two days trying to get to the bottom (top) of this and you resolved it immediately.
Your name came up in lots of my online searches.Last edited by JN-; 8th Jun 2022 at 16:42.
-
Interleaved is ok
It should be MBAFF, not "interlaced". x264 only encodes MBAFF not PAFF (what you think as "interlaced")
It should signal Top Field First. If field order is unknown or not signalled - it might be you're using a different ffmpeg binary - there were several changes in ffmpeg land over the last few months. You can add -vf setfield=tff
Code:-vf "telecine=top:2332, setfield=tff" -x264opts tff=1
-
Thank you. I was using a January 2022 static build. Just downloaded the 3 days ago full build.
I used this ... ffmpeg -y -i "%~n1%~x1" -vf "telecine=top:2332, setfield=tff" -c:v libx264 -crf 17 -x264opts tff=1 "%~n1-[TCNE].mov"
Mediainfo does show tff in the output file but I still don't get that info from the ffprobe output, namely field order=unknown. This is some of the ffprobe output from telecined file using the above ffmpeg syntax. ...
Video section
-------------
codec_name=h264
profile=High
width=1920
height=1080
has_b_frames=2
pix_fmt=yuv420p
color_range=tv
color_space=bt709
field_order=unknown
r_frame_rate=30/1
avg_frame_rate=30/1
start_pts=0
start_time=0.000000
duration=6.500000
bit_rate=22194142
I get a yellow ffmpeg output message ... "interlacing and weightp is not implimented", not sure that has any bearing on itLast edited by JN-; 8th Jun 2022 at 18:34.
-
Did you update your ffprobe too?
My ffprobe is about a month old and it shows field_order=tt
.
.
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=tt
.
. -
Yes, ffprobe was in the same zip, same date 6th-June-2022. I rebooted the laptop just in case, same result, field_order=unknown as last post.
If it's that volatile, ffprobe field order output, then I best not rely on it anyway I guess.Last edited by JN-; 8th Jun 2022 at 19:09.
-
Thank you so much. Just saw your reply. So I copied the latest ffprobe into the current directory where I am testing, working. It now outputs tt, thanks for doing that. I have my ffmpeg utils on a Windows PATH D:\ffmpeg\bin\ ... I bet that some other program that uses ffprobe has/is installed earlier in the PATH, i'll look into that later.
Yes. Works from PATH now. This means that I can now use my IVTC util as I intended, check incoming file for field order and set tt or bb accordingly. If it's neither then cancel.
Bed time here in Dublin. Thank you so much poisondeathray.Last edited by JN-; 8th Jun 2022 at 19:41.
-
Just one more thing
When I use the following on PAL 24p to produce a 25i output it works perfectly ... When I step through the 25i clip it produces 24 + the 25th. is number 24 duplicated.
ffmpeg -y -i "%~n1%~x1" -vf "telecine=top:222222222223, setfield=tff" -c:v libx264 -crf 17 -x264opts tff=1 "%~n1-[TCNE].mov"
The problem is that my ITVC syntax now produces a 20p output from the 25i file, not a 24p. I am using the same syntax that worked for 30i to 24p ...
ffmpeg %_DFPDISPLAY% -y -i "%~n1%~x1" -vf fieldmatch=order=%_FIELD_ORDER%:combmatch=full,yad if=deint=interlaced,decimate -c:v libx264 -crf %_QUALITY% %_AUDIO% "%~n1-[IVTC]%_EXTN%"
The "yad if" above is actually yadif in code.Last edited by JN-; 9th Jun 2022 at 07:53.
-
-
Just saw your reply now, out shopping.
Brilliant, works perfectly, thank you so much.
How come I didn’t need to enter a “cycle” value when going from 30i to 24p, is it perhaps that 30i is a default ? -
The default cycle for decimate is 1 in 5 (because the most common case is "NTSC" decimation from 29.97 to 23.976)
https://ffmpeg.org/ffmpeg-filters.html#decimate-1
cycle
Set the number of frames from which one will be dropped. Setting this to N means one frame in every batch of N frames will be dropped. Default is 5. -
Excellent, thanks for the link, something to study up on, though I think that I have 99% covered with 5 and 25.
Last edited by JN-; 9th Jun 2022 at 10:36.
-
Maybe worth to mention in relation to the ffmpeg list of frame rates below and the "Cycle" option. I tested a 24p clip, Telecined to NTSC 30i and also PAL 25P then did IVTC using cycle values of 5 and 25 and everything aok.
I tested also a 20 fps clip and it went fine also ... 20p --> 30i -->20P using cycle value of 3.
But when I tested two other clips with frame rates of 18 and 16 I could never get back to their respective starting frame rates.
So 18 --> 30i --> ? and 16 --> 30i -- ?.
They would have by my calculation a cycle value of 2.5 for 18 frame rate and 2.14285 for a 16 fame rate.
NTSC Output (30i)
----------------
27.5p: 32222
24p: 23 (classic)
24p: 2332 (preferred)
20p: 33
18p: 334
16p: 3444
----------------
PAL output (25i)
----------------
27.5p: 12222
24p: 222222222223 ("Euro pulldown") ... 12 chars. Produces 24 + 1. 25th frame=duplicate of 24th..
16.67p: 33
16p: 33333334 ......................... 8 chars.
---------------- -
ffmpeg's -vf decimate only supports 1 in N decimation. It does not support cycleR , or M in N - so you cannot "undo" all of the patterns.
You could use avisynth or vapoursynth, which have decimation filters with more options
eg. tdecimate
http://avisynth.nl/index.php/TIVTC/TDecimate -
“ you cannot "undo" all of the patterns” I understand that bit. Thank you for the clarification, I now know that it is indeed limited to the two. I will just use the 20p and 24p that can be undone in ffmpeg.
I prefer to keep it simple and stay with ffmpeg, the other tools would require going beyond my capabilities.
Similar Threads
-
Restoring this messy telecine-interlaced video
By rrats in forum RestorationReplies: 12Last Post: 17th Oct 2021, 06:49 -
ffmpeg changes interlaced to progressive
By SF01 in forum Video ConversionReplies: 12Last Post: 30th Mar 2020, 09:51 -
Edit progressive footage and output as interlaced DVD
By Gibson's Squares in forum Video ConversionReplies: 16Last Post: 3rd Oct 2019, 19:00 -
Interlaced or telecine?
By gamjerr in forum Newbie / General discussionsReplies: 15Last Post: 9th Apr 2018, 19:11 -
interlaced or progressive scan
By devdev in forum Video ConversionReplies: 8Last Post: 11th Nov 2017, 12:09