View Full Version : TFM and TDecimate analysis pass(es?)
Blankmedia
5th November 2021, 21:15
Am I correct to understand that this would be my first pass:
MPEG2Source(video_path.d2v, info=3)
AssumeTFF()
RoboCrop(LeftAdd=6, TopAdd=2, RightAdd=2, BotAdd =2, align=True)
TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch( Last ),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True,output ="video_path_metrics_TFM.txt",d2v="video_path.d2v")
TDecimate(Mode=1, output="video_path_metrics_TDecimate.txt")
and this my second pass:
MPEG2Source(video_path, info=3)
AssumeTFF()
RoboCrop(LeftAdd=6, TopAdd=2, RightAdd=2, BotAdd =2, align=True)
TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch( Last ),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True, input="video_path_metrics_TFM.txt",d2v="video_path.d2v")
TDecimate(Mode=1, input="video_path_metrics_TDecimate.txt", tfmIn="video_path_metrics_TFM.txt")
Or should it be different, like first run only tfm, then a run with TFM and TDecimate, so 2 analysis pass in total.
Julek
6th November 2021, 04:26
Examples: https://github.com/pinterf/TIVTC/tree/master/examples
Blankmedia
6th November 2021, 05:33
Examples: https://github.com/pinterf/TIVTC/tree/master/examples
Thank you, so if I understand, unless I want to go the vfr way, I don't have to do 2 passes. Am I understanding this correctly?
Julek
6th November 2021, 14:33
Yes, TDecimate mode 1 doesn't need two pass.
hello_hello
6th November 2021, 15:04
TDecimate mode=1 isn't a VFR mode, so as Julek said, there's no need for 2 passes.
For VFR mode, the first pass should be mode=4 and the second pass mode=5 for TDecimate.
I usually create both passes in the same script and comment out one pass accordingly. Something like:
# First pass
TFM(output="D:\0101TFM.txt")
TDecimnate(mode=4, output="D:\0101TDec.txt")
# Second pass
# TFM(Input="D:\0101TFM.txt")
# TDecimnate(mode=5, hybrid=2, input="D:\0101TDec.txt", tfmin="D:\0101TFM.txt", mkvOut="D:\0101Timecodes.txt")
# Comment out any addition filtering for the first pass
# SomeFilter
two pass mkv vfr example (https://github.com/pinterf/TIVTC/tree/master/examples/two pass mkv vfr example)
Of course you can add other arguments if you wish, but once the first pass has run, be careful not to open the script until you comment out the first pass lines or the metrics files will be over-written and you'll need to run the first pass again.
I'd avoid any filtering before TFM/TDecimate, except maybe standard cropping with Crop() if need be, partly because you don't want it to mess with the creation of the metrics files and partly because it might be be faster if it follows TFM/TDecimate, because it'll probably have less frames to process.
For encoding I usually add the timecodes file to the x264 command line so it can encode in VFR mode.
Alternatively you can add the timecodes file when muxing, but if you give the timecodes file to x264 to play with, there's no need when x264 is writing it's output directly to an MKV (I'm not sure when the output is a raw AVC stream).
The script's output will be at the average frame rate, because Avisynth itself doesn't support VFR, so don't worry if you notice the frame rate is odd.
For the x264 command line:
--tcfile-in "D:\0101Timecodes.txt"
I know nothing about x265 or whether it has a VFR mode.
If you're using a GUI such as MeGUI and adding encoding jobs to the job queue (and using separate scripts for each pass), the timecodes file doesn't need to exist when you add the job to the queue. It'll be created as soon as the second pass script is opened. Of course for each job you add the the queue, the command line for x264 needs to specify the correct timecodes file that'll eventually be created.
Blankmedia
7th November 2021, 03:32
Thank you guys!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.