View Single Post
Old 26th December 2019, 22:19   #7  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
For PAL I don't think there's a way to automate the process (the TIVTC plugin can do it for NTSC as long as you only de-interlace to 29.970fps). I'll confess though, I don't fully understand how the method FranceBB suggested earlier works.

If there's only a small number of progressive sections I'd probably just run QTGMC on the whole thing, and sometimes even for the progressive sections I use QTGMC().SelectEven() or something similar to clean them up a bit, even when the output will be VFR, but my process is something like this, which can be fairly time consuming.

Create the initial script and open it with MeGUI's AVS Cutter. Use it's preview to find the interlaced and progressive sections and specify the start and end frames for each, then save the "cuts" as MeGUI calls them. From there you add the required de-interlacing to each section and the end result will be something like this.

For this example QTGMC() is used on it's own to de-interlace the interlaced sections. I've followed the progressive sections with AssumeFPS(50), as Avisynth requires a constant frame rate. Temporarily adding GreyScale() sometimes makes the next step a little easier.

film=Last
__t0 = film.trim(0, 25849).QTGMC()
__t1 = film.trim(25850, 52749).AssumeFPS(50).GreyScale()
__t2 = film.trim(52750, 58007).QTGMC()
__t3 = film.trim(58008, 66063).AssumeFPS(50).GreyScale()
__t4 = film.trim(66064, 67577).QTGMC()
__t5 = film.trim(67578, 70921).AssumeFPS(50).GreyScale()
__t6 = film.trim(70922, 73651).QTGMC()
__t0 ++ __t1 ++ __t2 ++ __t3 ++ __t4 ++ __t5 ++ __t6
# crop and/or resize or whatever else here as required.

When that's done you need to go through the process again to find the frame numbers for the timecodes file. They'll change, as for example, the first section now has twice the number of frames so it'll be frames 0 to 51699. I generally find the new frame numbers by opening the scrpt again with the AVS cutter and adding a second lot of trims. If stepping through the script is slow, you can temporarily replace QTGMC with Yadif(Mode=1).
Because the "film" sections are greyscale it makes it harder to mistake an interlaced section for progressive etc and end up with a mess. I'm roughly calculating frame numbers here, so they mightn't be exact, but the second lot of trims added to the script would look like this:

film=Last
__t0 = film.trim(0, 51699)
__t1 = film.trim(51700, 78598)
__t2 = film.trim(78599, 89112)
__t3 = film.trim(89113, 97167)
__t4 = film.trim(97168, 100193)
__t5 = film.trim(100194, 103536)
__t6 = film.trim(103537, 108994)
__t0 ++ __t1 ++ __t2 ++ __t3 ++ __t4 ++ __t5 ++ __t6

Next step is to create a timecodes file using the frame numbers from just the progressive (25fps) sections. It's a text file.

# timecode format v1
Assume 50
51700, 78598, 25
89113, 97167, 25
100194, 103536, 25

Or you can do it the other way around:

# timecode format v1
Assume 25
0, 51699, 50
78599, 89112, 50
97167, 100193, 50
103537, 108994, 50

Once you've created the timecodes file you can delete the second lot of trims from the script, remove GreyScale() from the progressive sections and supply x264 with the timecodes for VFR encoding by adding the following to the custom command line section in MeGUI's x264 encoder configuration (obviously with the appropriate file path and file name).

--tcfile-in "D:\Timecodes.txt"

If the encoder is writing directly to MKV there's no need to add the timecodes file again when muxing the audio etc with the encoded video. If the encoder is writing a raw h264 stream, I'm not sure.

It can be a lot of work when there's many interlaced and progressive sections, but that's how I do it when I'm really keen.

Last edited by hello_hello; 27th December 2019 at 01:19.
hello_hello is offline   Reply With Quote