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.

 

Go Back   Doom9's Forum > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th November 2019, 23:27   #1  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
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
and my avs script (avisynth+)

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)
Dgi file shows hybrid interlaced/3:2 pulldown with interlaced opening credits and soft telecine 3:2 main video.



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.
Logan9778 is offline   Reply With Quote
Old 30th November 2019, 12:32   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,642
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.
hello_hello is offline   Reply With Quote
Old 30th November 2019, 19:52   #3  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
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.
Logan9778 is offline   Reply With Quote
Old 30th November 2019, 22:39   #4  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,028
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
manolito is offline   Reply With Quote
Old 1st December 2019, 00:18   #5  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,408
Quote:
Originally Posted by Logan9778 View Post
Never have messed with a VFR video, so I don't know what I'm doing wrong.
The DVD isn't VFR and what you're doing wrong is trying to work with an MKV of a DVD.

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.
manono is offline   Reply With Quote
Old 1st December 2019, 01:45   #6  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
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.
Logan9778 is offline   Reply With Quote
Old 1st December 2019, 03:06   #7  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by manolito View Post
the last one is IVTCed using the ancient DG tools Telecide and Decimate
Oldies but goodies!

Nice encodes, by the way, manolito.

Probably time for an official 64-bit DGIndex.
videoh is offline   Reply With Quote
Old 1st December 2019, 04:45   #8  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
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.
Logan9778 is offline   Reply With Quote
Old 1st December 2019, 05:10   #9  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
Quote:
Originally Posted by Logan9778 View Post
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.
I've been trying out some other programs that I'm not that happy with, but one shows that they are seperated by chapters in the vob's.
Logan9778 is offline   Reply With Quote
Old 1st December 2019, 05:11   #10  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,408
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.
manono is offline   Reply With Quote
Old 1st December 2019, 05:18   #11  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
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.
Logan9778 is offline   Reply With Quote
Old 1st December 2019, 13:58   #12  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,642
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).
hello_hello is offline   Reply With Quote
Old 6th December 2019, 02:14   #13  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
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.
Logan9778 is offline   Reply With Quote
Old 14th June 2021, 03:39   #14  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
Thanks guys! In the end, I found out it was my computer messing up. I re-installed a fresh copy of Windows about a year ago, and was just trying MakeMKV again. Works fine now. Still wary of it though. Will probably try something like Staxrip. PGCDemux is great, but takes a lot of work to rip many individual shows out of a DVD.
Also, just tried PGCDemux, which I was having trouble ripping multiple VOB's at once with ( I had to to do them one title at a time ), and now it can rip multiple titles at once as well. Seems it was Windows 10 messing up all along.

Note to self - MakeMKV puts out variable frame rate video and seems to mess with audio timing, so continue to use PGCDemux and just make individual .VOBs out of the main (1st) PGC. Use Create a PGC VOB, and then check One file per vid. Uncheck all the other demux boxes as they just give you one big file of audio and subs ( 2 files in total ).

Last edited by Logan9778; 14th June 2021 at 06:07.
Logan9778 is offline   Reply With Quote
Old 19th June 2021, 08:45   #15  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,408
Quote:
Originally Posted by Logan9778 View Post
PGCDemux is great, but takes a lot of work to rip many individual shows out of a DVD.
As I mentioned a long time ago:

Quote:
Originally Posted by manono View Post
You can do the same thing while decrypting to the hard drive with DVD Decrypter.
DVD Decrypter can be set up to decrypt all the episodes at once separately.
manono is offline   Reply With Quote
Old 19th June 2021, 15:12   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,266
A Bit O.T. here, but both DvdDecrypter and DvdShrink mentioned in thread [I dont really know where I should post this as new thread].
I generally use decrypter on entire disk, and then Shrink on individual episodes, extracting uncompressed as separate DVD folders for each episode.
However, when extracting Subs (subrip, as srt), they (the subs) are more often than not timed as for original DVD entire playlist,
ie each episode subs have to be re-timed again.
In Subtitle Edit, I generally subtract the start time for the first subtitle [Syncronize Earlier to 00:00:00.000] for the entire srt, then play the title and set to
start at the time where first words are spoken [Syncronize Later].
Doing this for every episode is real tedious, what am I doing wrong and is there an easier way, maybe some setting in Dvd Decrypter
that will cause Dvd Shrink to extract episode subs correctly timed ?
[I did try looking for Dvd Shrink source, but dont seem available]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 19th June 2021, 18:41   #17  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,089
I've not tried myself but isn't MakeMKV able to back-up 'series' based DVD's into separate episodes?
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 19th June 2021, 19:02   #18  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,266
Thanks SMD, I've never ever used MakeMKV, but I kinda like using DGIndex and SubRip,
also, I'm toying with the idea (for personal use) of modifying DGIndex_Batcher to accept directory of
episode VOB folders named eg "01", "02", "03", etc, to batch process them accessing all "VTS_01_?" only,
"VTS_01_1.VOB", "VTS_01_2.VOB" etc, to index & produce avs files, and again with
MeGUI_AutoEncode_Batcher mod to add "01.avs", "02.avs" files along
with "01.srt" style subs, would save an awful lot of sweat and tedium doing episodic jobs.
(I like to have English subs available, just in-case some speech is a little inaudible).

EDIT: I used to like directors/others commentary and subs too, but easier not to bother.
Also, in re-doing some series, I've already got the subrip OCR files so I dont havta assist so much in the OCR thing
when doin' subs again [so SubRip is very defo my preference].

Then at end I do a bulk rename, and also on subs files so I dont have to re-do subs srt files in any future redo [x265 perhaps].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th June 2021 at 19:17.
StainlessS is offline   Reply With Quote
Old 25th June 2021, 01:07   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,266
Well I seem to have stumbled upon the solution to my O.T. question posed in post #16.
My problem occurred when processing [subRip] multiple subs from consecutive episodes, and in a single subrip session.
Subs timing were way off when opening IFO's subsequent to the first one, when you do this it asks if you want to add
the new IFO subs to the exiting ones [from previous subs scan], when you say no, it starts a new subs scan to produce
my required srt file, BUT, timing on new file starts as if appended to the previous file. [this happens with each subsequent
episode subs, so each srt file timings after the first one get more and more out-of-whack].
Simple solution is, after selecting the new episode IFO, and before pressing START buitton, click on the
Last TimeCode RESET button, to zero the last time code. Then you can click START button, and then
when presented with the,
Quote:
Information
Subtitles text file isn't empty.
Add to end of file ?
Click NO [as usual], and continue as normal.

No more probs, all timing correct. [Not a Decrypter nor Shrink prob at all, was an "Idiot User" problem ]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 25th June 2021 at 02:34.
StainlessS is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:53.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.