I'm new here, but have had a lot of one on one dialogue with hat over at TechPowerUp Forum and he suggested I come here for additional help.
I have a commercial NTSC DVD, (29.970fps) with a pattern of 1 progressive frame followed by 5 interlaced frames, in this repeating 6-frame pattern. For what it's worth, I know that the DVD is also commercially available in PAL format, but I do not (yet) own that. I'm trying to secure a copy of it to see if I can get a better result.
Short sample, here: https://www.sendspace.com/file/2gska6I've tried a number of methods to detelecine and/or deinterlace using MeGUI + AVISynth, but am not finding the result I am looking for.
Regardless of whether I use QTGMC to deinterlace, or IVTC to go to 23.976 or use various commands to get a 25fps (PAL-ish) end result, I end up with plenty of jutter, and overall non-smooth playback.
My guess is that this was originally shot on film, and then transposed to PAL, and subsequently to NTSC 29.970?
Any thoughts on how to revert to it's original form?
thanks in advance~
+ Reply to Thread
Results 1 to 30 of 30
-
-
For future reference, when asking for help with DVD sources, don't put it in an MKV container because it costs us time to properly prepare it. Cut a VOB or (better) M2V using DGIndex.
MeGUI's analysis is useless with something like this. It can't be IVTC'd because it was never telecined to begin with. To get from a progressive 25fps PAL source to interlaced NTSC DVD output, it was field blended. To undo the damage you have to unblend it doing something like this:
QTGMC()
Srestore()
That will give you a 25fps result. To get it back to its 'original form' as you asked, you have to slow both the video and audio to film speed. -
Also should point out that you need
qtgmc()
srestore(frate=25)
As srestore() gives me 28.744fps along with extra duplicate frames
More info on srestore and the dependencies needed to get it running.
http://avisynth.nl/index.php/Srestore
OP has a MKV source because it was decrypted and muxed with MakeMKV (which uses mkvmerge). L-Smash seems to have indexed it fine. I managed to extract a .MPG video file just fine with MKVExtract, but that .MPG seems of had no duration information so DGIndex and other progams could not deal with it. However VLC could play it fine.
Ended up having to use Videoredo to remux the .MKV to both .TS and .MPG to compare indexed frame numbers. The .MKV indexed with L-Smash had 369 frames, and the .TS and .MPG indexed with DGIndex had 368 frames. Remuxing with tsMuxer to .TS, gives me 368 too. -
I extracted the MPEG 2 data as MPG with MkvExtractGUI, built an index with DgIndex (honor pulldown flags), ran QTGMC().SRestore() (369 frames before those functions), and got 25.000 fps.
-
As did I. Hence the advice in my original post to which KarMa seems to have some objection.
Not if you do it correctly.
As he stated plainly in his thread title, it's an NTSC DVD source.
You could have saved yourself time and trouble by doing it right the first time. Or U2Joshua could have provided an M2V to begin with. Your experience demonstrates the wisdom of not providing DVD samples repackaged as MKV. -
The problem with mpeg2 in an MKV is that neither ffms2 or L-Smash honour pulldown flags by default. DGIndexNV probably does, as would DGIndex.
Because ffms2 and L-Smash both treat variable frame rate sources the same way and output the average frame rate, and because a hybrid NTSC source with pulldown flags would be considered VFR, the result can be frame rate unpleasantness. MeGUI's settings for applying "force film" only work with DGIndex(NV).
Not that pulldown flags appear to be the problem in this case. It's possibly something to do with jitter in the MKV timecodes and the way the frame rate is calculated.
If I open the sample after remuxing it as a TS file with TSMuxer, index that with DGIndex and add Info() to the end of the script, everything is as expected (369 frames), but even though LSmash shows the same number of frames in MeGUI's preview after indexing the MKV, the frame rate is 29.9711fps. For me if I add QTGMC and SRestore to that script the output ends up as 28.7436fps. Adding AssumeFPS(30000,1001) to the script first results in the same output as DGIndex and SRestore outputs 25fps. If I extract the video stream and index with L-Smash, it outputs 29.970fps without the help of AssumeFPS(30000,1001) so I assume it's an MKV timecodes issue.
Admittedly I'm using an older (XP friendly) version of L-Smash.
FFMS2 behaved normally for me when indexing the MKV as long as I used threads=1. Same output as DGIndex. Without threads=1, it appeared to be changing the field order on occasion which could potentially make a mess. When opening the extracted mpeg stream with ffms2 it behaved the same way.
For the record, repeat=true is the L-Smash option for honouring pulldown flags (it's ignored if you use L-Smash's VFR to CFR conversion). For ffms2 it's rffmode=1.
MeGUI could probably be taught to add those settings, but it currently doesn't so it's not advisable to index mpeg2 video with either unless you're aware of the dangers. Ripping with MKV isn't necessarily a bad idea. It might be easier in some respects than traditional methods, but I'd extract the video first or use TSMuxer to remux the video in the MKV as a TS file for encoding (I haven't used DGIndexNV myself so I don't know what it's like). If you're only re-encoding the video, when it's done you could open it with MKVMergeGUI, add the original MKV created by MakeMKV, de-select the original video stream and remux.Last edited by hello_hello; 6th Dec 2016 at 08:52.
-
Thanks, everyone, for your help and sharing. Clearly, I'm out of my league on experience and technical know-how, here. Please accept my apologies for not realizing the error of sharing a segment in .mkv format.
I do have the NTSC DVD. What is the best way for me to provide a sample of the video that is most universally accepted on this forum?
Also, if I'm gathering correctly, it seems that some of you have determined this to be a 25.0 fps original source? If that's true, would I do best to simply find the PAL version of this video in order to convert to digital for streaming playback, etc.? -
The best way is to rip the DVD to a VIDEO_TS folder first (DVD Decrypter, DVDFab, AnyDVD), then use VOB2MPG to export a title as MPG. Then use an MPG cutter like Mpg2cut2 to mark and save a small section. But usually, after ripping, you can just load a VOB file into DgIndex, mark a section, then File -> Save Project and Demux Video. Upload the .m2v file that creates.
By the way, a clip with slightly faster motion would have been better. You want to have enough motion between frames to easily see what's going on. But not so much that it's heavily motion blurred.
The DVD was probably made form a 25 fps PAL video tape. The real "original" was probably film at 24 fps. Film is typically sped up to 25 fps for PAL TV. Having dealt with a lot of material like this one suspects the correct frame rate after removing blended fields is 25 fps. You usually verify this by finding a long panning shot and making sure there are no duplicates or missing frames after SRestore().
There's no way of knowing for sure. All kinds of crazy stuff happens with DVDs. A PAL release might be better or it might be worse. -
If you've already ripped using MakeMKV, you can open an MKV with TSMuxer and remux the video as a TS file. DGIndex can open them. TSMuxer also has a splitting function. Or gMKVExtractGUI will extract the video stream from an MKV as an mpeg file. It can't split though, so you'd have to split the MKV first. It requires MKVToolNixGUI to work.
If the original was a PAL 720x576 DVD source it'd have a higher resolution than a 720x480 NTSC version, and therefore "potentially" a little more picture detail, but try SRestore as suggested. It generally does a pretty good job of removing the blending and restoring the 25fps progressive frames. If you're indexing the MKVs you ripped with L-Smash or ffms2 make sure the output frame rate is correct and add QTGMC and SRestore before any cropping or resizing. If you remux or extract the video first so MeGUI can index it with DGIndex there shouldn't be any problems.
AssumeFPS(30000,1001) # try this if the output isn't exactly 25fps
QTGMC()
Srestore()
Info() # to check the frame rate in MeGUI's preview.
SRestore is one filter that you can't instantly preview because it needs to work on a pattern of frames, so don't worry too much if it appears not to have fixed the blending in the preview. Encode a bit to test it. -
Forgive me if I completely missed the drill, here, but I followed your advice in ripping the DVD with DVD-Decrypter. From there, I tried to use VOB2MPG, but didn't have immediate luck figuring that one out. I skipped ahead to where you suggested I could likely feed the .VOB through DgIndex and select a segment to demux - I did that, then received the resultant .m2v file.
Here it is: https://www.sendspace.com/file/i3ijcj
Please let me know if this is correct / helpful.
thanks in advance~Last edited by U2Joshua; 6th Dec 2016 at 11:33.
-
Thanks, @hello_hello. Not sure I understand the purpose of "indexing" (the MKVs), here... Are you saying I need to "index" (don't know what that means) my MKVs before MeGUI could possibly/properly render my MKV files to their 25.0 fps source formatting?
Unfortunately, I think I'm more confused now than ever.
Perhaps, if someone is willing, I should simply start over by asking the question:
"I have an NTSC DVD that I'd like to properly deinterlace / detelecine from 29.970 fps to whatever it's proper source fps is (25.0)? What are the basic steps from beginning to end?"
Thanks in advance~ -
It's analyzing the video and building a map (index) of all the frames. This makes it faster, easier, and more accurate to locate exact frames during decompression. Editors and encoders may request frames out-of-sequence so it's important to be able to locate the exact frame on request.
Rip as VIDEO_TS folder. Use Dgindex to load the VOB files and build an index of the portion of the video you want, and extract the corresponding audio as an elementary stream (usually AC3). Open the index file with Mpeg2Source() in an AviSynth script. Apply appropriate filters, in this case QTGMC() and SRestore(), in the AviSynth script. Encode with whatever encoder you want that supports AviSynth scripts as input. I usually mux the original audio (from the DgIndex step) with the newly encoded video. But you may want to convert and compress the audio to some other format like AAC.
Occasionally you'll come across a DVD with multiple titles interleaved in the VOB files (ie, a little of the first title, a little of the second, then a little of the first title, followed by a little of the second, etc.). Those will require the use of VOB2MPG to de-interleave the titles to get the one you want. The output will be an MPG file which you can index with DgIndex. -
I assumed you'd be familiar with the indexing process because you mentioned MeGUI. To use it you'd open the source with the File/Open menu, which should open it with MeGUI's File Indexer. It generally preselects the best indexer for the job, and allows to you choose any audio streams you want to keep/re-encode. Add the indexing job to the queue and run it. When the indexing is finished and the audio is extracted the script creator will open with a preview.
Apply any cropping or resizing as required (but not de-interlacing or IVTC etc) and manually add QTGMC and SRestore to the script under the Script tab. I assumed you've used QTGMC before given you mentioned it. You'll have to download the SRestore script too and any additional plugins it requires. Add them to your script before any cropping or resizing. Under the script tab in the script creator you should end up with something like this (I enabled cropping and resizing just to include them as an example):
LoadPlugin("C:\Program Files\MeGUI\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\sample.d2v")
QTGMC()
Srestore()
crop(2, 0, -2, 0)
Spline36Resize(720,544)
Save the script and add it to the queue to encode.
For the above script to work you'll need to have AVIsynth installed (not just MeGUI's portable version) and the QTGMC and SRestore scripts in the "installed" AVIsynth plugins folder (not MeGUI's plugins folder). If they're in that folder they'll load automatically when Avisynth runs and the script will work. Without AVIsynth installed you'll need to manually import QTGMC and SRestore into your script as well as load the plugins they require. Have you used either before because getting them working might be an adventure in itself.Last edited by hello_hello; 6th Dec 2016 at 13:45.
-
@hello_hello,
Yes, I've got MeGUI + AVISynth, including QTGMC and SRestore installed in the AVISynth Plugins folder. I'm successfully using this suite of tools in other experimental video encoding efforts, etc...
I was confused by the "indexing" portion, as you outline above. I'll play around with it as you've described and update.
Thanks! -
So, I've messed around with the settings / options you've recommended, and unfortunately my final results are still very "jerky" / "juttery" playback.
Here's my DVD to .mpg workflow:
DVD -> VIDEO_TS (DVD-Decrypter) -> title.MPG (VOB2MPG) -> .MPG sample clips (Mpg2Cut2):
sample clip 1: https://www.sendspace.com/file/s6wqsrsample clip 2: https://www.sendspace.com/file/3iji55
MeGUI Workflow:
I open up the sample .MPG clips with MeGUI: File -> Open (select .MPG Clip), I select "File Indexer" and it automatically selects DGIndex, then I select "Queue." The Script Creator Preview video screen pops up - I "X" out and close it. In the next screen, the AVISynth script creator, under the (I/O) tab I make no changes. Under the Script tab, here is what I see/create:
setmtmode(5,4)
...then I select "Save." Next, under the "Input" tab under "Video encoding" I select "Queue," and then the rendering process begins...
LoadPlugin("C:\Users\XXXXX\MeGUI_2624_x86\tools\dg index\DGDecode.dll")
DGDecode_mpeg2source("E:\Linear-clip2.d2v")
setmtmode(2)
qtgmc()
Srestore()
The results, however, are giving me an even more "jiggy" / "juttery" motion playback than the already terrible 29.970 version on the DVD.
Result:
Sample clip 2: https://www.sendspace.com/file/ofekdm
Any thoughts/feedback? Am I doing something incorrectly with MeGUI? That's where I'm not 100% if I've followed your recommended tutorial exactly or not.
p.s. Of my 2 sample clips, it's the 2nd one (aerial flyover footage) that reveals smoothness, or lack thereof, moreso than the first sample. On that 2nd clip, as the dam, rocks and trees pass by it's so very "jerky" / "juttery."
thanks~ -
Update:
In changing the above Input Script Tab to:
setmtmode(5,4)
LoadPlugin("C:\Users\XXXXX\MeGUI_2624_x86\tools\dg index\DGDecode.dll")
DGDecode_mpeg2source("E:\Linear-clip2.d2v")
qtgmc()
Srestore()
that is... I remove "setmtmode(2)" only, I'm getting much better results / playback.
Does that make any sense to anyone? I'm only using the setmtmode(5,4) and setmtmode(2) because a friend told me to, a while back, and if I remove setmtmode(2) my encodes work, just fine, but if I remove setmtmode(5,9) I get an immediate error message and the encode won't work.
I don't even know what the setmtmode inputs are/do.
thanks -
SetMtMode controls the multithreading in AviSynth. The first argument is the mode, the second is the number of threads to use. You can only set the number of threads once, usually at the start of your script. You can change mode at any time in the script.
Basically, the lower the mode number the faster the processing. But some filters don't work properly with the lower numbered modes. They may crash or simply deliver less than optimal results. You generally want to use mode 3 to 5 for the source filter. I've always used mode 5 before Mpeg2Source.
Generally, you want the number of threads to be between the number of threads your system supports and 2x that number. If you use too few or too many threads processing speed will not be optimal. And with many threads you may run out of memory. You generally optimize this experimentally for a particular script.
So your script starts with mode 5 and 4 threads. I don't recall having problems with mode 2 and QTGMC/SRestore in the past. But I'm seeing the same as you with this clip. I have to leave it at mode 5 to get smooth results. -
Thanks, @jagabo.
...so, the "number of threads"... does this corresond to my computer's number of cores? My friend who uses (5,4) uses a quad core computer, and I just realized my computer is only 2 cores.
I tried using the script, above, with (5,4) on a longer file (the entire DVD in question) and it crashed my computer about halfway through the process... back online now, but not sure what to modify to give this another go? -
It depends on whether your cores support hyperhreading or not. 2 cores without hyperthreading is a 2 thread CPU, 2 cores with hyperthreading is 4 threads.
In mode 5 the number of threads doesn't really matter. Try 1 thread. Ie, SetMtMode(5,1). -
Thanks so much, everyone. I think I've got a fairly satisfactory result due to all the help I've received on this thread.
I feel my journey has only begun
If I may, I will likely continue to lean on some of you experts for help as I explore additional videos, etc.
One question, right out of the gate, as it pertains to the tutorial offered in this thread as to how to go from DVD to end result... Same question, except, how about if the source is BD? I see DVD Decrypter doesn't run BD.
thanks in advance! -
I think the free DVD Fab can still decrypt BD.
https://www.videohelp.com/software/DVDFab-Decrypter -
Thanks, @jagabo!
New Project (let me know if you think I should start a new thread):
Commercial Blu-ray that has a Music Video as an "Extra" which is not HD... rather, it's a "DVD" file (NTSC) 720x480 mpeg-2 / 192 Kbps ac-3 audio. Using both AnyDVD and DVDFab I'm able to extract the .m2ts stream, but don't know what to do with it from there. Additionally, I can use MakeMKV to... ...well, make an MKV of the music video / file
The video is a mess! It's a mix of 29.970 fps interlaced video (portions of the music video of the band performing in the studio) and 29.970 fps telecined (3:2 pulldown) film (originally 23.976 fps) - portions of the movie that are used in the music video.
F̶i̶r̶s̶t̶,̶ ̶h̶o̶w̶ ̶c̶a̶n̶ ̶I̶ ̶p̶r̶o̶v̶i̶d̶e̶ ̶a̶ ̶s̶a̶m̶p̶l̶e̶ ̶p̶o̶r̶t̶i̶o̶n̶/̶c̶l̶i̶p̶ ̶o̶f̶ ̶t̶h̶i̶s̶ ̶v̶i̶d̶e̶o̶ ̶t̶o̶ ̶s̶h̶a̶r̶e̶ ̶f̶o̶r̶ ̶p̶e̶e̶r̶ ̶a̶n̶a̶l̶y̶s̶i̶s̶ ̶/̶ ̶f̶e̶e̶d̶b̶a̶c̶k̶?̶ ̶N̶o̶t̶ ̶h̶a̶v̶i̶n̶g̶ ̶l̶u̶c̶k̶ ̶w̶i̶t̶h̶ ̶v̶o̶b̶2̶m̶p̶g̶ ̶a̶s̶ ̶t̶h̶e̶ ̶.̶m̶2̶t̶s̶ ̶f̶i̶l̶e̶ ̶i̶s̶ ̶n̶o̶t̶ ̶a̶ ̶V̶O̶B̶,̶ ̶o̶b̶v̶i̶o̶u̶s̶l̶y̶.̶ ̶I̶ ̶c̶o̶u̶l̶d̶ ̶c̶u̶t̶ ̶a̶ ̶p̶o̶r̶t̶i̶o̶n̶ ̶o̶f̶ ̶t̶h̶e̶ ̶M̶a̶k̶e̶M̶K̶V̶ ̶f̶i̶l̶e̶,̶ ̶b̶u̶t̶ ̶t̶h̶a̶t̶ ̶c̶a̶u̶s̶e̶d̶ ̶p̶r̶o̶b̶l̶e̶m̶s̶ ̶o̶n̶ ̶m̶y̶ ̶l̶a̶s̶t̶ ̶v̶i̶d̶e̶o̶ ̶s̶u̶b̶m̶i̶s̶s̶i̶o̶n̶ ̶a̶s̶ ̶i̶t̶'̶s̶ ̶n̶o̶t̶ ̶u̶n̶i̶v̶e̶r̶s̶a̶l̶l̶y̶ ̶a̶c̶c̶e̶p̶t̶e̶d̶ ̶b̶y̶ ̶t̶h̶e̶ ̶v̶a̶r̶i̶o̶u̶s̶ ̶i̶n̶d̶e̶x̶e̶r̶s̶,̶ ̶e̶t̶c̶.̶.̶.̶ ̶F̶o̶r̶ ̶n̶o̶w̶,̶ ̶h̶e̶r̶e̶'̶s̶ ̶t̶h̶e̶ ̶e̶n̶t̶i̶r̶e̶ ̶v̶i̶d̶e̶o̶ ̶a̶s̶ ̶a̶n̶ ̶.̶m̶2̶t̶s̶ ̶f̶i̶l̶e̶,̶ ̶a̶s̶ ̶i̶t̶'̶s̶ ̶n̶o̶t̶ ̶o̶v̶e̶r̶l̶y̶ ̶c̶u̶m̶b̶e̶r̶s̶o̶m̶e̶ ̶(̶1̶8̶5̶m̶b̶)̶:̶ ̶h̶t̶t̶p̶s̶:̶/̶/̶w̶w̶w̶.̶s̶e̶n̶d̶s̶p̶a̶c̶e̶.̶c̶o̶m̶/̶f̶i̶l̶e̶/̶7̶y̶y̶s̶p̶n̶ ̶
Edit: was able to convert .m2ts to .ts using TSMuxer, and then used DGIndex to cut sample clip: https://www.sendspace.com/file/rnj01k
Second, is there a way to properly deinterlace and detelecine a video such at this? My expectation is that the proper resultant encode would be variable / mixed framerate, with the film portions returning to 23.976 fps after detelecining the 3:2 pulldown portions, while the video portions would remain 29.970 fps, but would be deinterlaced.
Thanks in advance!Last edited by U2Joshua; 7th Dec 2016 at 13:22.
-
No, those portions are field blended from a PAL source, just like your earlier sample. Plus, that studio section also has some slow motion effects with additional blending. So, it's a mess. I don't do VFR, although that's one way to do it. You could just bob the whole thing and be done with it, although that would keep all the blending. You could do the same as with your earlier sample (bob/Srestore) and get 25fps out of it, although that will leave you with duplicate frames for the hard telecined parts. If the majority is made of the PAL to NTSC crap, that's probably how I'd handle it. I don't think there's any real 'right' way to do it.
-
I'm not saying any of the following applies to your current sample (I haven't looked at it but it probably doesn't) however for "normal" hybrid NTSC sources you'd select the appropriate source option in MeGUI's de-interlacing section, ie mostly film or mostly interlaced, and for the former the output would be 23.976fps. Any 29.970fps sections would be frame blended back to 23.976fps. For "mostly interlaced" sources it'd be done the other way around. I don't work with NTSC all that much but neither would be ideal unless the frame rate conversion is only being applied to a very small section of the source, or somewhere where it doesn't matter too much such as the opening titles.
For variable frame rate encoding of "normal" hybrid NTSC sources with MeGUI you can use the TIVTC plugin and create two scripts. The first script is added to MeGUI's job queue with the "Queue analysis pass" button and the second is added as a normal encoding job. The first script creates the metrics files required. This would be an example.
TFM(Output="D:\TFM Episode 1.txt").TDecimate(Mode=4, Hybrid=2, Output="D:\TDecimate Episode 1.txt")
The second script creates the timecodes file and does the encoding. Something like this:
TFM().TDecimate(Mode=5, Hybrid=2, Input="D:\TDecimate Episode 1.txt", TFMIn="D:\TFM Episode 1.txt", mkvOut="D:\Timecodes Episode 1.txt")
TFM also has an option called clip2 which would allow you to use another deinterlacer such as QTGMC.
You can encode the video and add the timecodes file when muxing the output with MKVToolNix in order to make it variable (it'd be encoded at the average frame rate) or you can encode in variable frame rate mode by giving the x264 encoder the timecodes file to play with (under the Misc tab in the encoder configuration). Obviously it has to be specified before the script is added to the job queue, but it doesn't have to exist at that point. It's created as soon as the script is run. You just need to specify the appropriate file name. For example.
--tcfile-in "D:\Timecodes Episode 1.txt"
When adding the analysis script to the job queue, MeGUI checks it which will cause TFM and TDecimate to output incomplete metrics files. If the metrics files exist they'll be overwritten and you'll have to run the analysis pass again. It's just something to be aware of because it wouldn't be too hard to overwrite the metrics files and then run the encoding script which would either fail or produce rubbish output (I can't remember which).
If you could use Bob/Srestore on your sample as manono suggested to output 25fps sections and 24fps sections with duplicate frames, I'm not sure how you'd go about removing those duplicate frames for a variable frame rate output. Someone else may know if it's possible but I'm pretty sure TIVTC only expects combinations of 23.976fps and 29.970fps in variable frame rate mode.Last edited by hello_hello; 8th Dec 2016 at 15:31.
-
Wow! thank you, @hello_hello. I've read your last post twice, already, and my head is still hurting, but I'm optimistic that with some trial and error I may be able to make some progress with it.
Things I've tried, already:- MeGUI using IVTC: entire file rendered at 23.976 fps = movie/film segments look great... live/band segments look like crap - very jerky/juttery, as the original source is either 29.970 or 25 (jury is still out on that... I assumed 29.970 by doing frame-by-frame viewing, and thought I saw all interlaced frames, meaning it was 29.970, but @manono says they're PAL --> NTSC, 25 fps in origin. He very well could be right).
- MeGUI using QTGMC & Srestore: final outcome 25 fps = band segments look "okay" (can't tell if it's restored to native, or just did a decent job of downframing from 30 to 25), but the films sections look like crap as they have gone from film --> PAL.
- MeGUI using QTGMC: entire file at 29.970 = best looking final outcome of the ones I've tried, so far. After all, this is what the DVD/Blu-ray rendering of this file is - an NTSC (29.970 fps) video, which when played with proper deinterlacing is "satisfactory," all the while not as optimum for straight up digital playback on NAS devices to streaming players, etc.
thanks! -
Not theoretical. It definitely works. The Avisynth process and any filters used aren't effected. TDecimate generates the timecodes file (it's just a text file) but it still outputs a constant frame rate as that's all Avisynth can do. However it doesn't convert the 29.970fps sections to 23.976fps etc for a constant frame rate as it normally would. The frame rate used is the average frame rate (I think), but when you give x264 the timecodes file it ignores the script framerate and uses the timecodes file instead. That's where each frame is given a specific duration for which to display, or something to that effect.
I don't understand the technicalities as such, but x264 knows what to do with the timecodes file. This is what the timecodes file created by TDecimate looks like.
# timecode format v1
Assume 29.970030
# TDecimate v1.0.3 by tritical
# Mode 5 - Auto-generated mkv timecodes file
0,3,23.976024
49,52,23.976024
58,61,23.976024
107,114,23.976024
170,173,23.976024
259,262,23.976024
343,490,23.976024
# vfr stats: 36.67% film 63.33% video
# vfr stats: 220 - film 380 - video 600 - total
# vfr stats: longest vid section - 85 frames
# vfr stats: # of detected vid sections - 6
The default frame rate is 29.970fps and the 23.976fps sections are specified as a range of frames. That was a weird source I was playing around with but it gives you an idea how it works.
The alternative is to encode at the script's output frame rate and add the timecodes file to MKVMerge when muxing, and the display duration for each frame is set then. That's the way it was done until x264 was made variable frame rate aware. Unfortunately though I don't think any automatic method is designed for handling anything other than normal hybrid NTSC and wouldn't understand combinations of 25fps and 24fps, although going by what you've reported the QTGMC/Srestore combination wasn't too successful anyway, so maybe just de-interlacing with QTGMC is the best option.
If you really wanted to mess around, and I'm not sure if it's the easiest way to do it as this isn't something I've specifically done myself, and assuming SRestore is doing a reasonable job on the "PAL" sections, you could specify ranges of frames to be processed differently in the script. Something like this (just making up frame numbers):
Trim(0,1487).QTGMC().Srestore()\
++Trim(1488, 6548).TFM().TDecimate().AssumeFPS(25,1)\
++Trim(6549, 12874).QTGMC().Srestore()
You'd have to speed the film sections up to 25fps (as I did for the film section in the middle in that example), or slow the PAL sections down to 24fps, as AVIsynth will complain if the frame rate of each section doesn't match. It doesn't matter though because you'd create a timecodes file, similar to the one above, telling x264 which frame ranges are 24fps and which are 25fps. A timecodes file matching that script could look like this:
# timecode format v1
Assume 23.976024
0,1487,25.000000
6549,12874,25.000000
Edit: Except I just realised it's not that simple. In my above example frames 0-1487 are from the 29.970fps source, but QTGMC\Strestore is being applied, reducing the number of frames for 25fps. So in the timecodes file you'd have to specify a frame range of around 0-1241 instead. The second range of frames is 1488-6450 in the source but after decimation and taking the first frame range into account, that becomes 1242-5247 in the output, if my maths is correct.
Or you'd create the script, then apply it and check it in MeGUI's preview again, making note of all the new frame ranges for the timecodes file. It's still do-able, but requires more calculating/checking.
As I said, I've never created VFR video manually that way myself (I've used the TIVTC plugin to do it for normal hybrid NTSC occasionally), but to make sure I wasn't talking rubbish I created a timecodes file like the one above and tested it, and the output appeared to play as expected on the PC. There'd be a bit of manual work involved creating the script and it could be time consuming depending on the length of the source, so I guess whether it's worth it or not depends on how much you care about it.
Also, I don't know if that sort of VFR is likely to pose problems for hardware players. The little I have is from normal hybrid sources and combinations of 23.976fps and 29.970fps aren't anything new or unusual. There's really no reason why the frame rate couldn't vary all over the place, but you never know.Last edited by hello_hello; 9th Dec 2016 at 18:43.
Similar Threads
-
How do you make a NTSC interlaced DVD video progressive?
By runlouierun in forum Video ConversionReplies: 54Last Post: 22nd Jun 2017, 22:27 -
NTSC interlaced dvd (29,976 fps) to progressive (23,976 fps) ?
By kalemvar1 in forum Video ConversionReplies: 2Last Post: 6th Aug 2015, 19:25 -
hybrid progressive interlaced dvd
By cybero75 in forum DVD RippingReplies: 8Last Post: 27th Jun 2014, 08:22 -
interlaced and progressive in same video. how to make only progressive.
By OmniShadow in forum Newbie / General discussionsReplies: 32Last Post: 18th Sep 2012, 23:44 -
NTSC : progressive or interlaced
By mathmax in forum Authoring (DVD)Replies: 54Last Post: 2nd Feb 2012, 07:06