Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 | Link |
Registered User
Join Date: Mar 2017
Posts: 112
|
How to deal with audio sync when encoding from Variable Frame Rate video?
Hey guys,
I've tried about everything I can think of to encode x264 video from a VFR mkv file. Audio sync is always off by about a second or so. I use MakeMKV to turn the VOB file into MKV's (They're short cartoons). This gives me an MKV with the video, audio, and subs. I then use DGIndexNV to make .dgi files for frame serving. I then load the .dgi into AVSPmod to filter it and send it to Simple x264 for encoding. I can load the avs file into MPC-HC, and it plays perfectly. But after I encode the file, and mux the new x264 video with the old audio file from the DVD, the sound is off. Never have messed with a VFR video, so I don't know what I'm doing wrong. Help Appreciated! Here is my mediainfo Code:
General Unique ID : 147060965416153412374963467168538817045 (0x6EA2E964D05565EA0E28DEBB4C19F215) Complete name : D:\Test Space\The Chronological Donald Vol. 1\Donald Duck 1\title08.mkv Format : Matroska Format version : Version 2 File size : 368 MiB Duration : 8 min 25 s Overall bit rate mode : Variable Overall bit rate : 6 108 kb/s Encoded date : UTC 2018-05-01 04:16:37 Writing application : MakeMKV v1.12.0 win(x64-release) Writing library : libmakemkv v1.12.0 (1.3.5/1.4.7) win(x64-release) Video ID : 1 ID in the original source medium : 224 (0xE0) Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : Variable Format settings, picture structure : Frame Codec ID : V_MPEG2 Codec ID/Info : MPEG 1 or 2 Video Duration : 8 min 25 s Bit rate mode : Variable Bit rate : 5 907 kb/s Maximum bit rate : 9 800 kb/s Width : 720 pixels Height : 480 pixels Display aspect ratio : 4:3 Frame rate mode : Variable Frame rate : 24.323 FPS Original frame rate : 29.970 (30000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.703 Time code of first frame : 01:59:08;17 Time code source : Group of pictures header GOP, Open/Closed : Open GOP, Open/Closed of first frame : Closed Stream size : 356 MiB (97%) Language : English Default : No Forced : No Original source medium : DVD-Video Audio ID : 2 ID in the original source medium : 189 (0xBD)128 (0x80) Format : AC-3 Format/Info : Audio Coding 3 Commercial name : Dolby Digital Codec ID : A_AC3 Duration : 8 min 24 s Bit rate mode : Constant Bit rate : 192 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 31.250 FPS (1536 SPF) Compression mode : Lossy Stream size : 11.6 MiB (3%) Title : Stereo Language : English Service kind : Complete Main Default : Yes Forced : No Original source medium : DVD-Video Text ID : 3 ID in the original source medium : 189 (0xBD)32 (0x20) Format : VobSub Codec ID : S_VOBSUB Codec ID/Info : Picture based subtitle format used on DVDs Duration : 8 min 9 s Bit rate : 3 617 b/s Count of elements : 118 Stream size : 216 KiB (0%) Language : English Default : Yes Forced : No Original source medium : DVD-Video Code:
LoadPlugin("C:\DGDecNV2053\x64 binaries\dgdecodenv.dll") DGSource("D:\Test Space\The Chronological Donald Vol. 1\Donald Duck 1\title08.dgi",fieldop=0) #Honor Pulldown Flags TFM(mode=0,order=1,pp=7,micmatching=0).TDecimate(mode=1) #TFF. Prefetch(8) ![]() EDIT: Well, I'm trying out TMPGEnc Works 7, and after a few hours of kicking it, I think I finally got it near what I want. I can only set about half the x264 options I want though. Doesn't seem near as good as what the Community has made. Last edited by Logan9778; 30th November 2019 at 06:06. |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,447
|
It'd probably pay to upload a sample of the MKV. Just enough so it's possible to tell if the audio is in sync.
It's possible, although I don't know how likely, there's both a video and audio delay. If they're the same, MediaInfo probably won't show any delay as it usually just displays the audio delay relative to the video. You could check the individual streams with gMKVExtractGUI. When you open an MKV, it should show two delay values for both the video and audio streams, the first being the delay set for the stream itself and the second showing the relative delay between video and audio. If they're all zeros, then it's something else. |
![]() |
![]() |
![]() |
#3 | Link |
Registered User
Join Date: Mar 2017
Posts: 112
|
Thanks for replying hello_hello!
I hope you don't mind me uploading the whole cartoon. It's just 8 minutes long, and went out of copyright sometime in the 80's. ![]() Most frustrating video I've ever encountered. Works fine on the DVD. Works fine in the .mkv made from MakeMKV. Works fine until I try to encode the video to x264. Then the sound goes out of sync. Both the original video and sound show 0ms delay after extraction. It's something to do with the VFR, but I don't know what. TMPGEnc actually manages to get it all right somehow, but the video is bit starved, bloated, and blurry, so that ended up a no go. I guess somehow, I've got to get Avisynth to match the video to the sound, but I don't know how, and can't find any posts on how to do that. https://mega.nz/#!iW4hGaya!W7raxRZhr...MLG34C0zRfBKhc Last edited by Logan9778; 30th November 2019 at 20:04. |
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,961
|
This was not so hard...
Here are 3 conversions using an ancient 32-bit StaxRip version. StaxRip uses AviSynth which cannot deal with VFR. I used DSS2Mod as the source filter which always converts VFR to CFR. The original frame rate of the clip is 29.97 fps. The VFR of your source is thanks to MakeMKV. The first encode is MBAFF TFF at 29.97 fps. The next one is deinterlaced at 29.97 fps, and the last one is IVTCed using the ancient DG tools Telecide and Decimate. They all are in perfect sync. I did not analyze the video too much, compare the encodes for yourself... Download here: https://we.tl/t-s3tS7dXnsJ Cheers manolito |
![]() |
![]() |
![]() |
#5 | Link | |
Moderator
![]() Join Date: Oct 2001
Location: Hawaii
Posts: 7,368
|
Quote:
Do it the time proven way by first creating a D2V project file using DGIndex followed by using the DGDecode.dll together with MPEG2Source (and an IVTC if needed) to create the AVS ready to encode. Everything you need together with the docs you'll want to read is found in the DGMPGDec package. |
|
![]() |
![]() |
![]() |
#6 | Link |
Registered User
Join Date: Mar 2017
Posts: 112
|
Thanks guys!
Knew I must be doing something really wrong. Guess I'll toss MakeMKV. Glad it was just that in the end. Maybe now I won't have to worry about VFR. I'm taking a look at Staxrip and DgIndex. See if I can figure out how to get the cartoons out of the VOB with them. Interesting about the DSS2Mod, I'll have to look at it if I ever have to deal with real VFR. You guys are some real lifesavers! ![]() Last edited by Logan9778; 1st December 2019 at 21:13. |
![]() |
![]() |
![]() |
#8 | Link |
Registered User
Join Date: Mar 2017
Posts: 112
|
Ok, stuck again.
I can't figure out how would I make a .d2v or .dgi file to just one of the cartoons from the .vob's? There are 8 .vob's in total which hold all of the cartoons crammed in against each other, some overlapping from one .vob to another. I was using makemkv to cut them out, but I guess it's not getting it right. Is there some other program that can tell where they begin and end? I guess I need some alternative to makemkv. |
![]() |
![]() |
![]() |
#9 | Link | |
Registered User
Join Date: Mar 2017
Posts: 112
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 | Link |
Moderator
![]() Join Date: Oct 2001
Location: Hawaii
Posts: 7,368
|
With the VOBs already decrypted and on the hard drive you can extract PGCVOBs or the elementary streams (audio, video, subs) for the various episodes using PGCDemux. You can do the same thing while decrypting to the hard drive with DVD Decrypter.
But it really depends on how the DVD is structured. There are all kinds of ways episodic DVDs can be set up. You can also use the [ and ] buttons in DGIndex to isolate the various episodes after opening multiple VOBs at a time. |
![]() |
![]() |
![]() |
#11 | Link |
Registered User
Join Date: Mar 2017
Posts: 112
|
Thanks. I'll try PGCDemux and see how it goes for now.
I had thought about cutting in DGIndex, but didn't know how that would really affect things. EDIT: Thanks man! So far, so good. I ripped them out to single .vob's, and mediainfo no longer reports them as VFR. Last edited by Logan9778; 1st December 2019 at 06:05. |
![]() |
![]() |
![]() |
#12 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,447
|
DVDShrink can re-author DVDs and it has an option to not split vob files. It just pays to set the default target size to something large so it won't unexpectedly "shrink" while it's re-authoring. (50000 MB is my default).
|
![]() |
![]() |
![]() |
#13 | Link |
Registered User
Join Date: Mar 2017
Posts: 112
|
Thanks! In the end, I used PGCDemux to rip the cartoons to a single VOB each, and then DGIndexed them to .dgi files for encoding in AVISynth+. However, I had one cartoon with a bunch of commentary put in front of it, and I figured out I could just cut the video using Dgindex, and if you set it to demux the audio at the same time, the audio will be cut to correct size as well, without having to re-encode it (the audio).
Last edited by Logan9778; 6th December 2019 at 02:17. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|