I've got some DVD rips which appear to be variable frame rate. As far as I'm aware, this is impossible, and yet it's what I have.
I rip the DVD using MakeMKV. I then extract the timecodes from the resulting MKV, and the timecodes appear to alternate betweem 50ms and 33 or 34ms timings:
So that appears to me to be variable frame rate, and this is how it's been ripped from the source DVD.Code:# timestamp format v2 0 50 83 133 167 217 250 300 334 384 417 467 501
This source video plays just fine. The video is interlacd and I'm trying to deinterlace it with QTGMC. However doing this produces a fixed frame rate video with the audio randomly out of sync. It's out of sync in such a way that you can't compensate with a delay - the timing shifts randomly throughout the video.
If I use FPSDivisor=2 with QTGMC to produce a video with the same number of frames and the same framerate as the original, and then remux the timecodes file from the original footage back into the new encode, then the new video with the original timecodes plays just fine with the audio correctly in sync. It also looks decent. I'd be happy to go with this for my encodes, except this manual step of remuxing the original timecodes is a bit longwinded when you have several hundred encodes to process.
And I can't help but feel that this is a mistake and there's something else I'm missing. This is animated footage, and I notice mediainfo reports the frame rate as:
Frame rate mode : Variable
Frame rate : 24.769 FPS
Original frame rate : 29.970 (30000/1001) FPS
So I'm wondering if there's some IVTC that needs doing as well? I've scanned the footage and it does seem to be a mix of interlaced and progressive frames, however there doesn't seem to be a fixed pattern to it (which is why I ended up using QTGMC). Some sections have no interlaced frames at all, some sections have 1 frame out of 5 interlaced, sometimes 3 or 4 frames in a row are interlaced. It doesn't help that the source framerate is such an odd number as well, although I wonder if this is just the result of averaging the weird timecode values that are present. I also noticed a slight discrepancy between this source FPS, and the result of my encode with FPSDivisor=2, which has a reported FPS of 24.770
Any suggestions as to what the heck is going on here, and/or how I can stop QTGMC from breaking audio sync, would be most welcome!
+ Reply to Thread
Results 1 to 12 of 12
Last edited by Statick777; 10th Jun 2018 at 15:52.
Decrypt your DVD using a proper decrypter and your problems go away. DVDDecrypter or DVDFAb should do the job. Since you said it's anime, then DVD Decrypter is probably okay.
As far as I'm aware, this is impossible, and yet it's what I have.
The video is interlacd and I'm trying to deinterlace it with QTGMC.
...and/or how I can stop QTGMC from breaking audio sync
Last edited by manono; 11th Jun 2018 at 13:33.
Thanks, decrypting with DvdFab does seem to have sorted it. I haven't completed an encode yet, but inspecting the output file as it's being generated shows it has a sensible frame rate of 29.970, so that's promising
I was using MakeMKV because Staxrip doesn't seem to behave well with VOBs, and I like the workflow in StaxRip for batch processing many many files (e.g many episodes), so that led me to using MakeMKV to rip the discs into individual files per episode. I had no idea it was messing up the decryption as well. So I'm back to encoding in MeGUI of which I really dislike the workflow, but at least it can work on a folder of VOBs no problem.
I'm pretty sure the footage is telecined but as I described earlier, there's no fixed pattern. For some parts it does one interlaced frame then 4 progressive frames for a while, so you think you found a pattern, and then it does 4 interlaced frames in a row. Sometimes whole scenes are entirely progressive. Sometimes you get many interlaced frames in a row. Sometimes one moving part of the picture is interlaced and another moving part is not. Then there are titles/credits/etc superimposed, which are always progressive, but often on top of interlaced animation. I figured QTGMC was the only was to get anything coherent out of it, and it does seem to be doing a decent job visually.
I'd post a sample but it's extremely well known copyrighted material, I own the DVDs and just want high quality content on my HTPC, but I don't want to break any rules or laws by uploading stuff. And really, to get a picture of how messed up the interlacing is, you'd need more than just a few seconds worth, which I think would definitely count as an infringement.
That pattern sounds highly unusual. How exactly are you looking at the video to determine the field pattern. Remember, you have to look at fields, not frames, if you want to understand what is going on with either interlaced video or with video that has been telecined from film.
I'd post a sample but it's extremely well known copyrighted material
OK so I went back to the video and attempted to IVTC using TFM and TDecimate, then remembered that when I last tried encoding these videos (a couple of years back) I tried this same method at first, and couldn't get a consistently clean output, which led me to discover QTGMC which did produce a seemingly clean output. Which is why I initially went straight back to that, now that I'm revisiting this project, as I remembered it as "working". So, trying TFM/TDec again:
With TFM mode 5 and TDecimate mode 1, a lot of frames (several thousand) are decimated, and the frame rate drops to 23.976, which all suggests this is the right course of action. It does also seem to result in smoother animation, so again this looks like it's the right thing to do. I still get a lot of combed frames coming through that aren't being field-matched, however, and none of the PP modes give end results I am happy with, causing those leftover combed frames to look very ugly regardless of which PP mode I choose (the choices here seem to be either blurry as hell, or blocky as hell). This is the point at which I gave up last time, and switched to QTGMC instead.
I have tried the various TFM modes and mode 5 gives the best results (least number of combed frames coming through). So now I'm running it with PP 0 and then running QTGMC over the final output with fpsdivisor=2 (to preserve the frame rate), and this is giving me good results. I realise this is hardly a perfect process, but I still end up with the same number of frames and the same frame rate, only with absolutely no signs of combing or ugliness on those leftover un-matched frames. For my next task I'm going to try and use the clip2 property to only include QTGMC processing where necessary, but if I can't get that to work then having QTGMC over the whole decimated clip is at least producing results I find acceptable, and with the frame rate now being correct these are by far the best results I've had yet
I'll try and get a short clip uploaded later today
Last edited by Statick777; 11th Jun 2018 at 10:14.
okay here's a short clip which demonstrates the changing patterns, and which also fails to neatly IVTC (many fields are unmatched and come through as combed frames in the final result)
using I for interlaced frames and P for progressive frames, with a dash to indicate where the pattern repeats:
the clip starts off as IPPPP-IPPPP-IPPPP
then after a while it becomes IPIPPPPPP-IPIPPPPPP-IPIPPPPPP
then there's a string of many consecutive interlaced frames. this is where I end up with lots of combed frames in the output.
there are also sections in the original video which are entirely progressive frames (not included here)
I'd be really happy to hear about a method I haven't tried yet which sorts this out!
Last edited by Statick777; 11th Jun 2018 at 10:14.
okay I've got QTGMC working using the clip2 parameter, so it's only used on frames that are known to be combed rather than on the entire video. Happy with these results, unless you can suggest a better way of tidying this all up then I'm going to go with this!
Animation has many duplicate frames. So after pulldown you can't just go by the I/P pattern. The best place to look is at panning shots where there was motion with every film frames. That clip is normal 3:2 pulldown with a little bit of residual combing from interlaced MPEG encoding artifacts.
Use a script like:
Mpeg2Source("export.demuxed.d2v", CPU2="ooooxx", Info=3) # deringing TFM() TDecimate() vinverse() # blend away residual combing
right, so that's basically where I am now, only with QTGMC cleaning up the residual combing rather than vinverse.
at the moment I've got it applied only where necessary (using the clip2 property) but since it seems to do quite a good job of cleaning up the whole image, I may well go back to running it over the entire clip
You can also use QTGMC's explicit noise reduction features. For example, EZDenoise=2.0, DenoiseMC=true, etc.
I should also mention that it's very common for cartoons to be shot on film, telecined to video with 3:2 pulldown, then effects added as video. So there may well be some 59.94 fps or 29.97 fps titles and other effects. And often shots are slowed or sped up to match the dialog. That's often done with field blending. A simple TFM().TDecimate() won't work for those shots.
here's the same clip using the encode script I'm going with, encoded to x265
still a few minor issues, but a vast improvement on what I started out with
running the whole episode now, and if it all looks good I've got 11 seasons to get through....