View Full Version : (PAL Problem ONLY!!) - How to get an m2v file and ac3/lpcm file that will sync


jaay
14th March 2002, 14:25
i have read many conflicting posts in this forum and would like a difinitive way of adjusting ripped lpcm or ac3 files so that they will be in sync when imported into maestro. i know there are ways round this in maestro but there must be a way to do it before you import them.

jaay
14th March 2002, 15:07
here are some as yet flawless methods all tested on vobs with delays in either ac3 or lpcm sound:
1: with the vob on your computer or on the dvd use smatripper to demux the m2v file and sound file to separate files and when you import this into dvdmaestro the sound will be in sync despite any delays in the original vob.
2: if the above simple procedure isnt working simply rip the vobs to you hard disk and get them into the EXACT same state as you will have them after you have authored your dvd with menus etc. in maestro using ifoedit. then compile your maestro project and then simply replace the out of sync vobs in the video-ts dir maestro has created with the original ones you ripped from the dvd. they will now work perfectly with your menus you created in maestro. you can also load up your ifos in ifoedit and do get vts sectors just to be sure. so far this has worked flawlessly for me.
3: this works as well for re-encoded video too. simply mak the dvd fit on a dvd-5 with no menu using ifoedit (doom9 has a great guide :)) and then demux your vobs using smartripper and import into maestro. they should all be in sync, but if not dont worry just follow step 2 after compiling!

benf2
14th March 2002, 18:30
Do you think this will take care of the sync problem of the audio sync becoming worst as the movie goes on. I have had a few movies that play ok for the first 1/2-3/4 then seem to start losing sync. I use smart ripper to rip then use flask with the cce or lsx plugin giving me a m2v and ac3 which i use Maestro 2.915a to author.

I know others have the same problem, I even tried one suggest of using Maestro audio sync, but that didnt fix it either, then i saw one person said to insert a black .bmp file.

I have used smartripper for a while now and i must have overlooked it, but where is the demux option to rip and save as a m2v and ac3.

Thanks for your input on this issue!!
Ben

jeffnoone
14th March 2002, 20:31
when you select "movie" in Smartripper, you will see a tab called "stream processing"

Click on this and you will see a list of the streams in set of vob's

Hit "none", then select the 2 you want - video is the first one, and then select "demux" from menu on right
then select the audio you want, in English NTSC usually the first one (0x80- there is a description which gives language and format eg 6channel), again select "demux" from options on right

Start the process, and you will have 2 demuxed files, and a set of empty vob's -this will save automatically in .m2v and .AC3/DTS format, the audio file will have the delay incorporated in output name

I also change max file size to 8GB in Smartripper, as you otherwise will have 2 video files if bigger than the defaultt 4GB - not a major issue, as DVD2AVI will join the output anyway

benf2
14th March 2002, 20:59
Thanks, I will give it a try. All the time i have been using smartripper(i use the stream processing all the time), never new i could save a step and save as m2v and ac3 at this point.

jeffnoone
14th March 2002, 23:44
on the synching issue, a few comments

The lengths of the of the video and the audio as reported by DVDMaestro should be very close - this is a KEY issue.

On most movies this is different by 2-5 units(each unit in DVDMaestro being a frame, or 1/30 of a second)
When the difference in lenghts in longer, often the reported audio offset is larger: for example you may have a .ac3 marked with a delay of -280ms (or about 8 frames)

Usually the audio offset is so small, that it is difficult for my ear to confirm whether DVDMaestro exactly synchs or not, but it looks synched

Having Cinemaster 2000 codec installed to allow preview is essential

When the audio offset is larger (>100ms) or when the differnce in reported lenghts is greater than 3-5 frames, then I do try the various resynching options


1. "sync audio track" seems to work well and creates a second complete audio track which repalces original (quick process)

2. for large -ve offsets (eg -150ms), I add the 500ms (15 frames)black slide at start and do the math described elsewhere. This works well and works at times when I have found "sync audio" not to work

3. for large +offsets, the audio track can be manually delayed by dragging in DVDMaestro timeline

4. if I want to get rid of some of the beginnning of the movie, I do the following: use the DVDMaestro clip function to cut off beginning (eg 30 sec of studio intro ), then create "sync audio track". the result will be a second audio track which is smaller that the original - noticeable in windows explorer, and this track will be synced with the video. You cannot clip the audio directly in DVDMaestro, but this process shows quite clearly how effective the "sync audio" is, no matter how much is chopped off in intro credits

If the DVDMaestro-eported audio and video lengths are significantly different and if movie is NTSC, then I believe other options should be considered, such as whether an IVTC filter should have been used to correctly identify the video frames (and number of frfames) to be transcoded)

jaay
15th March 2002, 00:11
yes those are all good methods, but i am a perfectionist and like to use original vobs if i can, and i find that the method using smartripper produces the best all round results, although i am unclear as to whether smartripper adjusts the audio itself or inserts some sort of 'flag' that dvdmaestro uses to adjust the delay. either way it works.
i also have another way that is working well too. but only if you are happy with 2 speaker audio only, and that is to use besweet to adjust for the delay and produce a nice mp2 audio file.

benf2
16th March 2002, 15:35
:D :D Well, I just tried the demux from the dvd with smartripper of the m2v and ac3 files and compiling with Maestro and burned a dvd. It plays great on my stand alone dvd player. Thanks for the shortcut in this process!!

Alphaloop
19th September 2002, 11:52
Well, even with the risk to destroy your smartripper-dreams: ;)
I tried the 7th chapter of the Blade 1 Widescreen Edition ('cause of a nice scene, where something falls on the floor and brings a nice sync sound). Delay by ripping/demuxing was -272ms. Put into Mestro, compiled, watched the result, which _IS_ definately not in sync!

SATANIC1
22nd September 2002, 22:24
I too just tried the method as described by JAAY on Devils Advocate. The audio and video are out of sync. I am looking for a SURE method on the cure for the delay set up by demuxing process. I also tried to decode the audio since that proved to not a delay to the extracted audio stream. But, alas, that didn't work also.

Fortunately, I was able to preview the work in Maestro before making a coaster. Any help on the sync problem would be appreciated.

Alphaloop
23rd September 2002, 00:54
Well, after a lot of tries and experiments, here are my results:

a) If I rip a chapter from within a movie, no sync at all. Don't know why, probably broken ac3 within a movie? Never mind, just experiments, not really necessary for serious backup rips...

b) Correct rip from the start of the movie: Maestro takes ac3 with its PTS and syncs it to the video stream, but rounds to full frames. (-80, -40, 0, 40 80, ... ms in my 25 fps PAL movie tries). Worst case scenario would be a +/-19ms, if I calc correctly... ;)

btw: I "fc /b"'ed a smartripper demux and a vobedit demux of a ac3: no differences at all. It hasn't to do with smartripper, just make sure the demux prog doesn't change the PTS of the ac3.

PS: Please excuse my awful English, it's my now quite ancient school knowledge. (school time, how many years ago...? *lugubriously counting...*

Matthew
23rd September 2002, 05:09
Here's the way I do it for negative audio delays.

We know AC3 delay corrector cuts in single frames. Each frame is 32 ms in length.

The other day I had an AC3 with negative delay (according to DVD2AVI) of -80 ms. I changed the delay in AC3 Delay Corrector to the smallest multiple of 32 that would result in a positive delay. That is -96. So Ac3 Delay Corrector cut off 3 frames and made a file with delay +16 ms.

In Maestro I zoomed in to the most detailed view and then dragged the AC3 file approx half a frame to the right (with PAL there are 25 frames per sec, hence 1 frame = 40 ms, 0.5 frame = 20 ms).

I then compiled the project for a few secs, then unchecked the compile box (result is one vob of 60 MB or whatever). Opened the vob in DVD2AVI and demuxed. The delay was like 26 ms so I dragged the AC3 to the left a bit in Maestro, compiled for a few secs, then demuxed the vob in DVD2AVI (no need to reopen DVD2AVI or the vob in it either). Repeated this until sync was correct. Best I could get the delay was either 15 or 17 ms (mouse wouldn't move in smaller increments) but 1 ms out of sync is impossible to detect.

Whole process only took a few mins ;)

And for positive delays, just drag to right in maestro, compile a bit, and use DVD2AVI until sync is exact (or close to it).

Alphaloop
23rd September 2002, 13:32
To detect the delays I use Tsunamis' streams.exe. Just a CLI tool, but very useful.

SATANIC1
23rd September 2002, 19:43
@Matthew

Most of my delays have been in the negative region thus far. For Devils Advocate I get -917ms after the rip. Therefore based on your method I would use 928 in the Corrector in order to get to +11ms...right? Then I would move my audio to the right about a half a frame. I will give it a try tonight and post my results.

One question regarding your pseudo compile. What exactly is that supposed to accomplish...

compiled for a few secs, then demuxed the vob in DVD2AVI (no need to reopen DVD2AVI or the vob in it either). Repeated this until sync was correct. Best I could get the delay was either 15 or 17 ms (mouse wouldn't move in smaller increments) but 1 ms out of sync is impossible to detect

When you demux the vob in DVD2AVI from the pseudo compile, are you then using the resulting files from the demux in Maestro? In other words, are you using the pseudo compiled files in Maestro to replace the original avi or m2v's?

I have used the delay corrector, BeSweet and other AC3 utilities to get this sync problem solved and I am about explode. Last night I started the whole process all over starting in square 1 and ended up in the same place. So I know the process I am following from the guides is ok (or maybe I am consistent with the way I am forgetting something). Do you think that the problem could be because of multiple PGC's? I don't think so but maybe it does. On other DVD's I have done, I had no problems with them but they were single PGC's.

I have access to Scenarist, do you know if Scenarist has better control in this area of syncronicity? I wish there was a cure for this sync issue.

Thanks for your reply...

Alphaloop
23rd September 2002, 19:53
>When you demux the vob in DVD2AVI from the pseudo compile, are you then using the resulting files from the demux in Maestro? In other words, are you using the pseudo compiled files in Maestro to replace the original avi or m2v's?

No, he just loads the created vob into dvd2avi and chose save avi. At the moment where the codec is requested he clicks on cancel, but has the already demuxed ac3-filename. That's just what he wanted, because the delay is included in the filename. After that he deletes the file and continues with the files he still/already has in Maestro. The dvd2avi stuff is just dummy for looking on the delay. Am I right, Matthew? ;)

Matthew
24th September 2002, 01:04
Yes that's right Alphaloop, except I use save project not save AVI ;) The purpose of the exercise is trial and error (looking at delay in AC3 filenames) until I get the sync as close as possible.

SATANIC1 you would indeed use a 928 negative delay in the Corrector so you'd get a fixed AC3 with +11 ms delay. But you'd drag it approx a quarter of a frame (not half) as there are 40 ms in one frame (PAL - 1000ms/25, it's a little different for NTSC).

I have little idea about PGCs etc as I don't need to. I just make a DVD with the re-encoded video stream + ac3(s) + subs and set the movie as the first play in maestro. No extras/menus = better quality video stream, and less effort to boot. But my syncing method should work the same if you are trying to do a reconstruction of the original DVD.

I have use Scenarist a little, but I haven't played around with it much (no need to, Maestro does all I need). But as I understand it you could use the above method as the AC3 can be dragged to the right.

SATANIC1
24th September 2002, 04:15
It worked! Thanks to all on this thread for the help especially Matthew and Alphaloop. I followed the procedure as detailed by Matthew and could not believe it only took 6 mins to get the files in sync. I was sooo close.

However, (it seems there is always a 'however') the TDK DVD-R I used is not playable on my set top Sony player. It plays well using MSI DVD 5.1 and other PC players but not on my set top. I used Nero 5.8 to burn the DVD-ROM (ISO). I have always used this method with no problems. Any suggestions?

Thanks again

Taz69
24th September 2002, 09:25
Sorry for jumping into the middle (or possibly just after a solution has been found) but I only noticed this thread whilst looking for something else.

The way that I have been demuxing the audio & video for use within Maestro is to use the d2v file generated by Smartripper rather than bothering with DVD2AVI and I have NEVER had a problem with audio & video being out of sync in Maestro...

I had been using VFAPIConv to create a dummy avi for CCE but since I've just upgraded to the later version of 2.64 I have started to use Avisynth and had no problems with that either.

I must admit that I normally rip PAL DVDs and don't need to worry abut Forced Film or IVTC. As the few NTSC DVDs that I have done I've just left at 29.970 and everything has come out okay.

I hope I don't cloud the issue but it might just be worth giving Smartripper's d2v a try sometime.

If anyone is prepared to try it I would be interested as to how you get on TTFN.

Alphaloop
24th September 2002, 10:44
@Satanic1:
>However, (it seems there is always a 'however') the TDK DVD-R I used is not playable on my set top Sony player. It plays well using MSI DVD 5.1 and other PC players but not on my set top. I used Nero 5.8 to burn the DVD-ROM (ISO). I have always used this method with no problems. Any suggestions?

I heard that some of the first 5.8.xx Versions of Nero had problems with writing 100% correct udf file system which caused some (or many?) standalones to refuse o play. Try upgrading to the latest version or try to burn from inside Maestro.

Matthew
25th September 2002, 02:54
Nice to see that it worked, the disc not playing thing would be certainly unrelated to the sync method though...maybe it's Nero, maybe it's due to problems replicating the DVD structure. For burning I create an image in maestro then use RecordNow DX to burn.

Taz69, does smartipper produce a d2v such that frames are cut off (for positive audio delay) or added (for negative audio delay) to the video stream? Otherwise I can't see how there wouldn't be a sync issue like there are with dvd2avi.

Taz69
25th September 2002, 04:13
I think this varies as I think with ac3 the sync is actually encoded in the ac3. As I have not had any problems with sound I have not really paid much attention.

I have recently done a SVCD > DVD conversion where the 3 parts of the movie overlapped. Originally I was off to use mp2 sound but I ended up convering my audio to ac3 because Maestro lost sync after the second & third parts were shortened and mp2 was unable to keep the audio in sync. With ac3 Maestro automatically retaind sync automatically dispite the shorening of my 3 clips to gain a seamless join.

By converting the sound to ac3. After I shortened the 2nd & 3rd clips sync was retained and I think this was because ac3 has a time code encoded into it.

One place where problems may arise could be if the audio is ripped from SmartRippers film processing mode (this would be just the film)and the d2v is generated from the VOBs (ie VTS_01_1-VTS_04_4) with DVD2AVI as sometimes the VOBs relevant to the film might also include additional frames such as the blank screens which are often included. This is a pretty wild guess as to where the problems are coming from though.

All I can suggest is you give it a try on your next project if it works Problem solved. If not then you'll have to sync the audio manually again but you won't have lost anything ;)

If it works okay for you let me know and I might try doing an alternative guide to help anyone else who is having problems.

SATANIC1
25th September 2002, 05:24
First off, thanks again for the responses.

Alphaloop...I re-burned using Nero 5.8 but this time I set it up as DVD-ROM UDF/ISO. This worked perfectly. Strange though?? I never had to use that mode before. I also have 5.9 but haven't seen a need as yet. Maybe now is a good time to "play" with it. As for burning with Maestro, gave that a try with no luck many moons ago (but that was when I was first getting into this). Maybe its re-visit time. What the heck, it's done.:D

TAZ69...I used the SmartRipper method as you described on my last try and that is what made it out of sync. I will check my settings and note them to see if there is a difference with other settings and post any info that may help others. I also use the VFAPI method because I had some trouble setting up the script for Avisynth. There were numerous guides I reviewed on the script for Avisynth before I tried it but no go for me. I was especially interested in the claims of Avisynth's speed over VFAPI. Since you use that process, is there a noticeable differance in speed? I have CCE Pro 2.5 and it should use the Avisynth process just fine but like I said, I get errors. I think I will look into it again just to know another method in case I should need it.

I would be intersted in your analysis of CCE SP 2.64. The writeup is great. you mentioned that you "upgraded" to it. I looked on their site for an upgrade from my version but could only find the trial version of CCE 2.64. Is this the one you are talking about?

Well, enough of this chatting. Time to get back and burn with different processes in mind. I will post results. Thanks...

Matthew
25th September 2002, 05:53
"I think with ac3 the sync is actually encoded in the ac3."

Well when I've used smartripper to demux it gives the delay in the filename. Plus if smartripper adds/removes frames to achieve sync I would think it's going have the same problem as AC3 Delay corrector - it can only cut in single frames, and each of those are 32ms.

Not meaning to have a go at you, just trying to figure out a rationale as to why using smartripper would result in perfect sync.

@SATANIC1

avisynth is faster than vfapi in every instance.

CCE 2.64.01.10 supports avs files, the versions in between 2.5 and this version don't (you have to use the slower vfapi). AFAIK the video quality is unchanged from 2.5 (it was as at the earlier build of 2.64). The problem with 2.64.01.10 is that it stops after vaf creation and after each pass, unless you use a fix. But using the fix before vaf creation means you can't put the iframes encoded into the video (which means chapter points will be a few frames off).

So I encode the vaf, CCE stops, then I start the mpv creation after using the fix (which is simply deleting and readding the avs in the edit->settings of the avs file. If I don't do this, mpv creation will stop 25 % of the way through (I use 4 pass VBR).

But 2.64.01.10 is more stable on my machine, I was getting freezing problems with 2.5.

As for the avs script, for DVD source all you need is something like this:

LoadPlugin("E:\PROGRA~1\MPEG2Dec\mpeg2dec.dll")
MPEG2source("H:\beautifulsample\beaut.d2v")

Holomatrix
26th September 2002, 16:19
Hi guys, sorry to bud in, but how do you find the delay in DVD2AVI? I have this movie that there is silence about the first minute of the movie because of some dedications and stuff. I've been trying to mess with muxing audio delay with TMPEG and have the synce pretty close (-46500 ms). I will try the smartripper idea to see if it gives me the exact delay but is there a way to load the VOB in DVD2AVI and find out what the actual starting delay is so I'm not guessing ???
Thanks

Taz69
26th September 2002, 18:05
SATANIC1 With regards to CCE I upgraded from 2.64.01.02 to 2.64.01.10 and the main diference is that 2.64.01.10 works with Avisynth (I am using 2.05 and it is working quite nicely :D) and yes I am using the trial version.

I'm sorry but I cannot really comment on the difference in speed yet because I used Avisynth to scale from 480*480 to 720*480 as well as feeding CCE and it seemed to be about as quick as using VFAPI to do a straight encode.

From this it looks like Avisynth is quicker (as I was scaling and encoding at about the same rate) but I can't say as yet as to how much quicker.

I would be interested in knwing if you are having sync problems with most things or is this an isolated problem with certain films. Also please let me know if you are doing PAL or NTSC DVDs as I have the PAL version of Blade and would be happy to see if I have any problems encoding it (or part of it) if it would help.

Also I can't comment on the differences between 2.50 & 2.64 as I have not used 2.50.

SATANIC1
28th September 2002, 02:58
Taz69: Thanks for the info. I just dl'd the trial version and I will give it a go with Avisynth. I discovered that my test avs script was missing a quote for the filename so I fixed that and the script now works. So I will test with a file on my next rip.

The DVD I was having a problem with, The Messenger, is NTSC, frame rate 23.976, video type film 99%.

Regards...

dannyv
14th November 2002, 20:49
[QUOTE]Originally posted by SATANIC1

However, (it seems there is always a 'however') the TDK DVD-R I used is not playable on my set top Sony player.


This may not be a problem with the disk but with the sony player. Most of the older sony players were not dvd-r compatible. I had a sony which was 2 years old and not dvd-r compatable and so could not play dvd-r on it. I recently got a panasonic which is cd-r and dvd-r compatable and my dvd-r's play fine on it.
You may want to consult the players owners manual on it's compatibility.

Mr Zippy
21st December 2002, 21:03
I have also been researching the AC3 delay, reading several forums and seeing different views.

I have tested 2 films partially in the follwing way..

1. Demux video and audio to hard drive with DVD Decryptor.

2. Import video and audio into DVDMaestro timeline in the following ways (video was simply dragged into the timeline on all 3 occations)...
a) Drag AC3 file into the timeline
b) Using Create Sync Audio without 'sync to timecode' selected
c) Using Create Sync Audio with 'sync to timecode' selected

3. Complile Movie in DVDMaestro

3. Create and ISO image with Nero

4. Load ISO image with Daemon Tools

5. Demux video and audio from the DVD image loaded on the Daemon virtual drive

6. Compare the delay figure from the demuxed audio from the original DVD to the DVD image loaded on the virtual DVD drive...

Movie 1 Original Delay -111ms
Method a) -80ms
Method b) -80ms
Method C) -80ms

Movie 2 Original Delat 0ms
Only tested method c) result 0ms

It would appear from this limited test that DVDMaestro detects the timecode within the orignal AC3 file and rounds this to a full frame as another user of this forum said.

The question is, as I am a perfectionist, how can we get DVDMaestro to correctly sync with the original delay, or what authoring program correctly syncs with AC3 delay?

Lets face it the DVDs were created in the first place with AC3 delay - how?

Matthew
22nd December 2002, 06:39
Mr Zippy, what's wrong with using the method I prescribe? It's easy and the only 'butchering' it involves is cutting a few frames off the front of the AC3 audio track(s). Which is hardly something to write home to mummy about.

mpucoder
22nd December 2002, 07:31
Here's something to check, but it will not be easy as VobEdit does not display these fields. In each NAV pack (DSI packet) there are 2 "audio gaps" for each of the eight audio tracks. This is to allow for cell sync, especially when using non-seamless interleaving (where the disparity between 16.7ms video frames and 32ms audio frames can be a problem). The gaps are specified in terms of the 90KHz system clock, so they have very fine granularity.
These fields start at offset 0x43B, and are described at http://www.mpucoder.com/DVD/dsi_pkt.html

As for DVDMaestro rounding to the nearest audio frame, this would suggest that it does not utilize the audio gap for fine sync.

auenf
22nd December 2002, 13:44
Originally posted by Mr Zippy
It would appear from this limited test that DVDMaestro detects the timecode within the orignal AC3 file and rounds this to a full frame as another user of this forum said.

The question is, as I am a perfectionist, how can we get DVDMaestro to correctly sync with the original delay, or what authoring program correctly syncs with AC3 delay?

Lets face it the DVDs were created in the first place with AC3 delay - how?

perhaps everyone is forgetting this:

http://www9.brinkster.com/sportschook/?ac3timecode.jpg

as for how they were created in the first place, the video and audio were created with the same timecode embedded within the stream, you are reencoding the video and giving it a new timecode, but the ac3 is keeping its old timecode.

Enf...

Mr Zippy
22nd December 2002, 18:19
Thanks for that, I did not realize that you could disable use of the embedded ac3 timecode. Using the AC3 Delay corrector to remove the delay, then ignoring the timecode would probably be the best solution.

The reason I was not keen on adding/removing audio frames, was because I thought if you remove the frames to make the AC3 0ms delay, then DVDMaestro would still see the original delay, therefore it would still be slightly out of sync.

One other thought
Does the demuxed AC3 file actually have a delay recorded within it that needs to be removed, or is it just the timecode the creates a delay, therefore simply ignoring the AC3 timecode would be enough.

DSPguru
22nd December 2002, 21:21
i guess it's possible to update AC3's timecode without re-encoding anything.

i once wrote a small tool that updates AC3's dialog normalization tag and then updates the crc1&crc2 tags.

Mr Zippy
22nd December 2002, 21:54
I think someone who knows a bit about DVD authoring and AC3 timecode should investigate AC3 Delay in depth, below is what I've found out.

I found this link http://arbor.ee.ntu.edu.tw/~jackei/dvd2avi/doc/issue.html to information on how DVD2AVI calucates AC3 Delay, basically the delay is simply when the first audio packet is played in relation to the first video packet and is a relative figure.

The AC3 file I belive has no physical delay in it, just a timecode within it that reflects the original delay.

What is the best way to sync the relative PTS timecode differences in demuxed AC3/M2V streams?

Theoretically if you demux a VOB file then drag the M2V and AC3 into an authoring program such as DVDMaestro it should read the timecodes and sync correctly - yet I find in my tests the output is 39ms different to the orignal delay, maybe this is OK as there article I reference above states less than 80ms should be undetectable to the human ear.

If you transcode the M2V you write a new timecode, will this affect the relative delay when syncing?

benf2
23rd December 2002, 13:09
Still, think the biggest problem i encounter is delays that start in the last 1/3 of the movie. Its like, how do u fix the last 1/3 without affecting the first 2/3?

Have not seen a good(dependable) method for this yet?

Mr Zippy
23rd December 2002, 19:28
Can I clarify yesterdays post...

The AC3 delay is calculated, if you start ripping from the second I frame, as difference from this 2nd I frame to the first audio frame.

Would I be correct in thinking that DVD Decryptor and DVD2AVI both start ripping at the 2nd I frame then, and either both the M2V and AC3 files either keep the orginal timecodes or are relativly adjusted for future syncing?

If this is true then the delay is directly relative to the start of the ripped M2V file, and you may as well just let DVDMaestro use the built in video and audio timecodes to sync, in my test this resulted in 31ms differnce, but the article I read says that the perceptial tolerance for delay skew is 80ms, so well within this.

Mr Zippy
23rd December 2002, 22:25
Explain this....

I used my -111ms AC3 test track, which when re-authrored with no editing shows a delay of -80ms (as shown in previous post).

I used delay corrector to try and cut the delay, it removed 3 full frames (96ms).

I re-authrored in DVDMaestro once ignoring the AC3 Timecode, and 2nd time using the AC3 timecode... Both times the resulting output according to DVD2AVI STILL had a -80ms delay.

Now this is stupid, as whatever I do the re-authored movie has an audio delay of -80ms.

If I actually drag the audio in the timeline this DOES affect the AC3 delay, I dragged 5 frames forward, now the delay is 113ms.

All very odd.

How can the delay stay the same if you ignor the AC3 timecode and cut frames from the AC3 file???

DVD__GR
24th December 2002, 01:05
Originally posted by DSPguru
i guess it's possible to update AC3's timecode without re-encoding anything.

i once wrote a small tool that updates AC3's dialog normalization tag and then updates the crc1&crc2 tags.


It would be really generous of you posting that program:) :) :) :) :)

Mr Zippy
29th December 2002, 00:49
Does noone have any comments on my post?

Form my tests DVDMaestro reads the timecode from the M2V and AC3 files, so this means most comments in this thread are useless.

Did anyone actually demux their created DVDs to see what the delay showed? I think not.

I have tired Sonic ReelDVD and DVDMaestro, both seem to read the orignal timecode, although both round this to a whole figure in my -111ms test, both gave -80ms output.

Matthew
29th December 2002, 02:31
With Ocean's Eleven the delay was -96 ms but when the untouched m2v and ac3 were reauthored in Maestro the delay came out at -80ms. Which is consistent with what you have found.

Also, recently I reauthored a DVD losslessly, by extracting the m2v with smartripper and AC3 with DVD2AVI. Regardless of whether the ignore AC3 timecode box was checked, the correct delay of -80ms came up after muxing in Maestro (without fiddling with the audio). This is equal to 2 frames (PAL).

However, when I re-encoded the video stream the delay came up as 0ms after muxing in Maestro. On further investigation it was clear that the re-encoded stream had 2 less frames at the beginning. So my solution in that instance is to use AC3 delay corrector to cut off 3 frames (96 ms) then have a positive audio delay of ~16 ms by dragging the AC3 to the right in Maestro.

Another case, I was losslessly reauthoring the last half of a title so it has a -255 ms delay (tends to happen in those instances). I cut the AC3 by 8 frames (256 ms) so delay should have been +1 ms after I dragged it to the right in Maestro. But it was -79 ms as a -80ms timecode was embedded somewhere (only because I hadn't re-encoded the video stream). So I simply dragged the AC3 to the right by another 79ms (or as close to it as I could get) until DVD2AVI reported a delay of +1ms. I could have also re-cut the AC3 by 6 frames (192 ms) and I would have had an AC3 with delay -63ms. As there was an embedded delay of -80ms I just had to drag the AC3 by 17ms to the right (so afterwards DVD2AVI would report a delay of -80ms + 17 ms = -63 ms). But I couldn't be bothered cutting the AC3 again so I just did it the other way. Either method would suffice, 2 less frames of audio is nothing.

Now provided that DVD2AVI is accurate in reporting delays all of this is academic is it not?

The loss of a couple of frames at the beginning does however have possible implications for the exact placement of chapter points.

Mr Zippy
29th December 2002, 17:32
I'm still a bit confused as to the best solution.

The AC3 Delay is givin so that we can correctly mux the video and audio back together in sync, yet no DVD authoring software seems to be available that lets you specifiy the AC3 delay for correct muxing - I note I have seen several DVD-DivX programs that DO let you input the AC3 delay for correct sync.

Now from my brief tests with DVD Maestro and ReelDVD they both seem to get a timecode from somewhere to make the delay -80ms whatever I seem to do, even if I remove frames with AC3 corrector.

What we need is a custom DVD muxing program, like there is for DivX, then we can use the supplied AC3 delay as I was meant, for 100% correct sync of the audio - commercial programs will never offer this as the delay is only for our reference when we come to re-sync the M2V and AC3.

mpucoder
29th December 2002, 18:18
Originally posted by Mr Zippy
yet no DVD authoring software seems to be available that lets you specifiy the AC3 delay for correct muxing

No mystery there, the "audio delay" was invented by someone after the fact. I'm not even sure how that measurement is defined, as there seems to be several ways to compute it. But it is not an input parameter for proper muxing. To achieve proper muxing, get the timecodes correct, and then programs like Maestro, Scenarist, StreamWeaver, and IfoEdit will do the rest.

Mr Zippy
29th December 2002, 18:29
I have posted a link within one of my posts in this thread as to how DVD2AVI works out AC3 delay, and as I said I know that AC3 delay is for our use only when re-muxing VOB files - so it would not be catered for in professional programs.

What we need is a program that will mux M2V, AC3, DTS and Subtitle streams, allowing us to use the very useful AC3 Delay figure to ensure the correct sync is preserved.

There are DivX programs that allow you to give the AC3 delay for correct sync when muxing, I would assume DVD2AVI would have been written with DivX in mind, hence why DivX muxing programs allow input of the AC3 delay.

mpucoder
29th December 2002, 18:41
I agree, since avi has no timecode, that the delay is useful for Divx, until someone comes up with an integrated encoder/muxer that goes from vob or demuxed streams straight to avi.
But for DVD the timecodes are all that is needed. What is needed here is a program to restore the original timecodes in m2v files. While they're at it, restore the original rff/tff (pulldown) flags, and it would also be nice to reinsert several other pieces of data that get stripped out, like CC and Pan/Scan position.

Mr Zippy
29th December 2002, 18:46
Would I be right in thinking if the timecodes were correct in the M2V and AC3 eveything would sync correctly?

If so when you transcode the M2V in CCE you can specifiy a timecode, so maybe this could be fixed by specifiying the correct timecode instead of 00:00:00:00.

Athough this does not follow, as if you just demux the VOB then remux the delay is still different.

I am really surprised more people have not looked into this, and written a nice program to help us, I support DVD writers have only just become mainstream.

Matthew
29th December 2002, 23:57
Originally posted by Mr Zippy
Athough this does not follow, as if you just demux the VOB then remux the delay is still different.

Exactly. AFAIK timecodes go to frame level only, no smaller.

I still don't understand why there are any problems with using the method I prescribed.

Mr Zippy
30th December 2002, 12:21
As I have said using AC3 Delay corrector shows no difference when I have tested, see my other posts.

Whatever I do with my -111ms test movie, the remuxed DVD authored with DVDMaestro always had a delay of -80ms, unless I physically drag the AC3 forward a couple of frames in the DVDMaestro timeline.

As I have said using AC3 corrector seems to be a waste of time, at least in my test, possibly as DVDMeastro is using the embedded AC3 timecode, whether I tell DVDMaestro to ignor it or not.

Cutting frames using AC3 corrector still shows the same delay, when tested, as if I had not cut any frames.

Did you read the page I linked to that explained how DVD2AVI calcualtes delay?

Mr Zippy
30th December 2002, 17:13
I see IFOEdit can remux M2V, AC3 etc. and you can specify the AC3 delay.

The only problem is negative delay gives an error and the program crashes.

I took my test -111ms audio track and muxed that entering a delay of 111ms just to test, the output showed a delay of 31ms.

Now if this program or similar worked correctly we'd have what we need, a program that will sync the video and audio back to have the orginal initial delay of the source VOB file. All we'd have to check is that the transcoded video is the same number of frames, which with CCE it is not, but I have read the dropped frames are at the end of the movie, so should not affect the delay sync settings.

Matthew
31st December 2002, 00:09
Okay I'll try to deal with this point by point.

"As I have said using AC3 Delay corrector shows no difference when I have tested, see my other posts."

Using AC3 delay corrector will not affect the recorded delay after muxing, what it does is adjust the AC3 so the delay is different. e.g. on a film with - 96 ms delay you cut 3 frames off and mux in Maestro. The delay will be 0ms according to DVD2AVI but that is fine as you have cut the AC3 to remove the delay. Similarly on a film with an -80 ms delay if you cut 3 frames the delay will now be +16 ms (-80ms + 96 ms), and you can make it as that in Maestro by dragging the AC3 to the right.

"Whatever I do with my -111ms test movie, the remuxed DVD authored with DVDMaestro always had a delay of -80ms, unless I physically drag the AC3 forward a couple of frames in the DVDMaestro timeline."

In my experience this is on account of 2 black frames at the start of the video stream which disappear when you re-encode the video stream. With CCE there are more lost frames but those are at the end of the movie. And those 2 frames at the start are only there to disappear where there is an appropriate delay (e.g. -80 ms, -96ms, - 111ms). With 0ms they are not there.

So here is what you do in the case of a re-encoded video stream, where the -80ms thing is a non-issue:
Cut the AC3 by the smallest number of frames that results in a positive delay. i.e. 4 x 32 = 128. That means your delay is now -111 + 128 = + 17 ms after cutting 4 frames using AC3 delay corrector. Drag the AC3 in maestro to the right by that much. As I said, you have re-encoded the video stream the -80ms won't come into it.

In the case of a non-re-encoded stream then after doing the above your delay according to DVD2AVI will actually be 17-80 = -63 ms. So what you do is drag the audio 3 frames to the right to make it +17ms like you want it to be.

Alternatively, you can cut only 1 frame off the AC3 (111-80 = 31, which is just less than 1 frame). The delay will then be -111 + 32 = -79 ms. As a -80ms delay is there to start with just drag the AC3 by 1 ms to the right (tiny tiny bit).

"As I have said using AC3 corrector seems to be a waste of time, at least in my test, possibly as DVDMeastro is using the embedded AC3 timecode, whether I tell DVDMaestro to ignor it or not.

Cutting frames using AC3 corrector still shows the same delay, when tested, as if I had not cut any frames."

Hope I explained these statements above.

"Did you read the page I linked to that explained how DVD2AVI calcualtes delay?"

Just tried to but page won't load ("cannot find server")

That delay in IFOedit makes sense. Embebbed delay of -80 + 111ms = 31 ms. If your case you would put in -31 ms. -80 - 31 = -111. But I prefer Maestro, it's more powerful ;)

Mr Zippy
31st December 2002, 19:09
Am I right in thinking that both the demuxed AC3 and M2V files start at 0ms, therefore I need to move the audio AC3 either ahead (- ms) or behind (+ ms) the video to ensure the correct sync. The method to do this is to change the 1st audio frame in the AC3 file to the frame that would have been played at the specified delay by adding/removing frames, rather than changing the time at which the first audio frame is played. So the physcial calculated delay should be 0ms (if the orginal delay is divisable by 32ms audio frames), but the audio frame that is played with the first video frame is still the same as in the orginal VOB.

I have a question on your method I quoted below,

"So here is what you do in the case of a re-encoded video stream, where the -80ms thing is a non-issue:
Cut the AC3 by the smallest number of frames that results in a positive delay. i.e. 4 x 32 = 128. That means your delay is now -111 + 128 = + 17 ms after cutting 4 frames using AC3 delay corrector. Drag the AC3 in maestro to the right by that much. As I said, you have re-encoded the video stream the -80ms won't come into it."

Now in my test dragging audio forward in the timeline adds postive delay ie. moves the audio behind, thefore you would end up making your +17ms AC3 track +37ms if you dragged foward half a frame in the timeline, as you would have moved it behind another 20ms.

Am I missing something, I'm getting confused now, as we are changing the first frame in the AC3 file by cutting frames, but then physically moving the whole AC3 file forward in the timeline also changing the actual physical delay.


Google cached page on how DVD2AVI works out delay....
http://216.239.39.100/search?q=cache:g36FDyAwRKkC:arbor.ee.ntu.edu.tw/~jackei/dvd2avi/doc/issue.html+dvd2avi+ac3+pts+delay&hl=en&ie=UTF-8

TRILIGHT
1st January 2003, 00:51
Originally posted by Mr Zippy
Form my tests DVDMaestro reads the timecode from the M2V and AC3 files, so this means most comments in this thread are useless.

I couldn't agree with this statement more! What in the world kind of process are you people trying that your audio is always out of sync? I don't know how many titles I've backed up in both Maestro and Scenarist now and it is always lined up correctly via the timecode. Perhaps because I use DVD Decrypter and not SmartRipper? Perhaps because the particular method I use does not result in the same issues whatever method you are following produces? The whole "delay" topic should be a non-issue if you're doing things properly.

Matthew
1st January 2003, 03:33
"Am I right in thinking that both the demuxed AC3 and M2V files start at 0ms, therefore I need to move the audio AC3 either ahead (- ms) or behind (+ ms) the video to ensure the correct sync. The method to do this is to change the 1st audio frame in the AC3 file to the frame that would have been played at the specified delay by adding/removing frames, rather than changing the time at which the first audio frame is played. So the physcial calculated delay should be 0ms (if the orginal delay is divisable by 32ms audio frames), but the audio frame that is played with the first video frame is still the same as in the orginal VOB."

Sorry I'm confused.

"I have a question on your method I quoted below,

"So here is what you do in the case of a re-encoded video stream, where the -80ms thing is a non-issue:
Cut the AC3 by the smallest number of frames that results in a positive delay. i.e. 4 x 32 = 128. That means your delay is now -111 + 128 = + 17 ms after cutting 4 frames using AC3 delay corrector. Drag the AC3 in maestro to the right by that much. As I said, you have re-encoded the video stream the -80ms won't come into it."

Now in my test dragging audio forward in the timeline adds postive delay ie. moves the audio behind, thefore you would end up making your +17ms AC3 track +37ms if you dragged foward half a frame in the timeline, as you would have moved it behind another 20ms."

No. I'll try to explain it graphically. Ideally you would move your audio file to the left on Maestro by 111 ms. So it looks like the following

Audio: AAABXXXXXX
Video: XXXXXXX

Where AAA = 111 ms and B = 17 ms

But as this is not possible you instead cut off AAA (imagine for a moment you can cut off 111 ms exactly). So it now looks like:

Audio: BXXXXXX
Video: XXXXXXX

In sync. But you cannot cut off 111 ms exactly, you have to cut off another 17 ms, i.e. B

So this is how it should look in Maestro:

Audio: XXXXXX
Video: XXXXXXX

See the audio is dragged to the right by 17 ms.

Hope that clears that part up :)

And TRILIGHT, going by the DVD2AVI reported delays on original and re-muxed dvds, it would not be the best method to rely on timecodes. I don't find this surprising as timecodes are on a frame by frame basis, whereas delays reported by DVD2AVI can be in increments (e.g. 96 ms on a PAL release is nowhere near a multiple of 40).

mpucoder
1st January 2003, 05:32
This thread is getting ridiculously circular. Timecodes were all the original authoring program (most likely Scenarist) had to use. The authoring software computes the correct Presentation Time Stamp (PTS) values based on timecodes, hopefully muxes the streams so that it is possible for the player to present them at the proper times. Alignment of the streams is not as important as it is in avi, as the player continously monitors the PTS values.
Yes, it is possible for the authoring software to ignore the timecode or apply an offset to it, but this is not what the "delay value" measures. Rather than comparing the PTS values of the first frame of video and audio for relative offset (which works great for avi alignment) we should be looking at the timestamp to PTS offsets of each stream when working with DVD authoring. This is what can be adjusted by dragging things around the timeline. For most DVDs, though, as Trilight and I have observed, these values are zero, and preserving the timecodes is all that is needed for proper sync.
Unlike avi, DVD does not require audio throughout the movie, it can start before or after the video, and may have gaps in it throughout the movie.

And, finally, a little hint about movie making and timecodes. The first frame of many productions is not time 0:00:00.00, but 0:59:xx.xx This is due to "pre-roll", a second or two of black/silence before the movie. This is a practice left over from automatic tape machines and VITC/LTC codes. Tape machines require a little time (mine need 20 frames) to get up to speed from a dead stop. Habits are hard to break, and whether preparing the movie for DVD or network presentation, the transfer is made with pre-roll. Since there is no negative time, 1:00:00.00 is used as the "start of presentation" time.

Matthew
1st January 2003, 05:49
So mpucoder am I correct in saying that we shouldn't be using DVD2AVI for detecting delays when it comes to DVDR?

I don't understand how it can be right to use DVD2AVI for AVI and wrong to use it for DVDR. I can understand that in practical terms it may be unnecessary to use anything other than correct timecodes (presumably this can be achieved by stamping the original timecode on the video stream using CCE?...although a couple of frames can be lost at the beginning of the re-encoded stream, as mentioned before) but as a matter of theory I don't understand how a mpeg2 video stream muxed with an AC3 can require a different delay value than a divx/xvid stream muxed with an AC3. That is to say, I don't understand how my method can be wrong, even if it practical terms using timecodes also achieves the right end.

Sorry if I sound like I'm being a pain in the ass btw, I tend never to shut up until I have no other questions ;)

mpucoder
1st January 2003, 06:47
AVI has no timecode, sync depends on the audio and video being properly aligned at the beginning, and the video frame duration (avi does not use frame rate, but duration) and audio sample rate being correct throughout. The difference between the initial PTS values is all that is needed to get it going properly by adding silence or removing some samples.

DVD, being a streaming medium, is quite different. First you must realize that while a movie has a beginning and end, an mpeg stream does not. So there is no initial alignment, only embedded timing information. The PTS value is what all MPEG decoders use to establish sync. This is not the timecode we refer to, though. At the encoding level each stream can have a timecode inserted, and then at the authoring level this timecode can be used to produce the PTS, or it may be ignored.

The objective is to do exactly what the original author did. Unfortunately, you can't be sure if timecodes were used or ignored. The majority of movies have correct timecodes, since that's how Hollywood likes to work. So there are 2 ways to go. Use the timecodes and let the authoring software line up the streams for you. Or disable timecodes and slide the audio around on the timeline by the delay value.

If timecodes are being used, cutting frames will not alter the sync, only introduce silence, since each frame has a timecode, the muxer will just adjust the PTS value accordingly.

The reason more and more of us are getting annoyed by the audio delay is that it addresses only one stream. We are seeing more and more posts about other streams (LPCM, DTS, and now subpictures) being out of sync. Mostly caused by destroying the video stream timecode. In the end it would be best to preserve timecodes and use them for DVD authoring.

Matthew
1st January 2003, 07:21
Thank you for clarifying.

"Or disable timecodes and slide the audio around on the timeline by the delay value"

If you mean what I think you do, well it's good to know that the method I'm using is correct for the audio on re-encodes, if nothing else. With subs, being a couple of frames off is not noticeable anyway - there can be differences like that on the original (e.g. english for hearing impaired subs may differ a little in timing from the plain english subs):)

Mr Zippy
1st January 2003, 13:25
This has gone back to what I posted a while ago about the AC3 track having a timecode.

Does any program (ie. DVD2AVI) preserve the original timescodes in the demuxed M2V and AC3 files?

If so all we need to do is ensure the timecode is set correctly in CCE when transcoding, this would save a lot of messing around and DVDMaestro would sync the stream automatically from the timecodes.

In my brief test ealier in this thread I got a differet delay in a demuxed then re-authored stream, now this would say that timecodes are not being preserved, as the reauthroed steam should show the orignal delay, as they are synced the same way.

What we need is...

1. A program that is known to demux the VOB streams preserving the orignal timecodes.

2. An accurate method of transcoding with CCE to preserve the orignal timecode.

Then all we would need to do it drag the AC3 and M2V into DVDMaestro and it would all sync (as long as we had not told it to ignor the orignal AC3 timecode).

Now this would be simpler, faster and more accurate than cutting frames and dragging in the timeline.

Mr Zippy
1st January 2003, 16:01
Just done a quick test,

1. Demux a VOB
2. Import the M2V into DVDMaestro and view properties to see offset (which appears to be start timecode)
3. Transcode the M2V in CCE setting the timecode to the offset figure from above.
4. Import the transcoded M2V into DVDMaestro, view properties, the timecode is set to the orginal offset :)

Now I have looked at the AC3 track in DVDMaestro, there is no offset (it's blank).

I believe the AC3 timecode is being lost, what we need to do is find a way to demux the AC3 leaving the embedded timecode, then no more messing around as DVDMaestro can sync from the file timecodes.

Only other thing to check is that CCE is starting with the first frame, as there are comments about 2 blank frames in the demuxed VOB and CCE dropping a couple of frames, now CCE needs to start with the same first frame as the orginal M2V as we are assigning frame 0 to the orginal timecode.

I have put the follwing post in the DVD Decrypter Site forum

Can DVD Decrypter be updated to transfer the orignal AC3 PTS timecode into the demuxed AC3 file.

Reason:
----------
The AC3 delay figure is for use only when creating AVI/DivX files as they have no timecode to sync the audio.

To sync a DVD the M2V and AC3 timecode is used in the authoring program.

The problem is AC3 stream output from programs such as DVD Decryter is there is no embedded timecode.

The AC3 PTS timecode is vital for correct audio sync when authoring.

The M2V output appears to have the orignal PTS timecode embedded, so that's not a problem.

Mr Zippy
1st January 2003, 23:06
I've added the folling article to my site

http://www.encodinginfo.org.uk/index.php?aid=129

Let me know if you think I have covered issue clearly.

Hopefully someone will find a problem to the missing AC3 timecode.

Matthew
2nd January 2003, 03:42
Mr Zippy I also performed a test. The AC3 + original video stream muxed with a delay of -80ms (according to DVD2AVI). However when I re-encoded the video stream with the correct timecode this inbuilt delay was not there (0ms according to DVD2AVI) after muxing. That would indicate only a video-stream related issue. Might have something to do with the 2 dropped frames at the beginning (and they are not black in this instance). I tried adding 2 frames to the timecode to account for this but no change in the result. [And "ignore embedded ac3 timcode" in maestro was unchecked].

BTW you can use bitrate viewer to get the timecode. Load vob and click on GOP straight afterwards. First GOP = timecode. No need to wait for demuxing etc ;)

I'm gonna stick with what I've been doing, as it works just fine :)

#BTW 2: saving the dvd as an uncompressed avi using DVD2AVI resulted in the first 2 frames being dropped, so it wasn't CCE's fault ;)

TRILIGHT
2nd January 2003, 05:13
No offense guys... you're more than welcome to talk about this til the cows come home. hehe ;) However, I think it's very important, especially for newbies who may be trying to learn, that you share the exact process you are using for your backups. Afterall, there are a great number of us who have absolutely no sync issues at all following the process we use.

airedale
2nd January 2003, 15:33
I have just started with CCE and Maestro and the only movie I have backed up is Silent Bob and Jay Strike Back. I did not have an audio problem at all and the file that I got from DVD2AVI came back with -66 ms, but I just dropped both the movie file and the audio file on the time line and compiled the movie. Didn't have a problem at all with the audio sync.

Mr Zippy
2nd January 2003, 16:16
Matthew if you re-encoded the video assigning the correct timecode then the delay would be the same, unless your frameserver or demuxer is adding extra frames and two PAL frames would be 80ms. I have read that mpeg2dec can have frame innaccuracies, mpeg2dec2 is supposed to be more accurate. Also one question how do you find out 2 frames at the start are added?

Trilight I am using the DVD Full copy and Getting the best out of CCE guides from this site.

I have not had sync problems yet, but I want to do this correctly, and the correct way would be to have an AC3 and M2V file with an embedded timecode, which is read when dragged into an authoring program - this is the way it would have originally been authored.

Now as in tests it makes no difference whether you select 'ignor AC3 timecode', and also when looking at the properties of the AC3 file there is no offset figure, I would say the issue is extracting the AC3 stream from the VOB with the timecode still embedded.

Mr Zippy
2nd January 2003, 20:16
The author of DVD Decrypter point out that you can output RAW AC3 which includes all the frame information including the timecode.

DVDMaestro and Senarist cannot read the RAW AC3 file.

Does anyone know how we could convert the RAW AC3 file to a usable AC3 file with the timecode still remaining?

Matthew
3rd January 2003, 02:05
"Matthew if you re-encoded the video assigning the correct timecode then the delay would be the same"

Well it isn't ;) Have you tried it yourself?

"unless your frameserver or demuxer is adding extra frames and two PAL frames would be 80ms"

Haven't checked that but the delay is 0ms so don't think so...

"I have read that mpeg2dec can have frame innaccuracies, mpeg2dec2 is supposed to be more accurate."

Using DVD2AVI to save as a lossless avi results in the 2 frames being dropped though.

"Also one question how do you find out 2 frames at the start are added?"

Womble MPEG2 VCR or whatever it is called. M2-Edit would also do the trick.

Alphaloop
3rd January 2003, 12:37
Concerning the frame problem at the beginning I did a lot of tests:

1) Rip the first chapter, no stream processing
2) check Frame number of the first non black frame with M2-Edit Pro
3) Demux video stream with vobedit
4) Do Step 2 with this demuxed .m2v file
5) Transcode with CCE (doesn't depend on VBR/CBR, when it happens, then in both)
6) Do step 2 with this transcoded .m2v file

Results:
a) The Original VOB and the demuxed M2V had always same frame position
b) The CCE transcoded M2V sometimes has its first non black pic two frames earlier (only tested PAL movies)

Notes:
There are two groups of movies, one group ( called group A) is okay, the other ( called group B) has this effect. But how to categorize movies into one of these groups?:
a) Group B had always some strange timecode shown in M2Edit (like 58:xx:xx or 03:xx:xx), group A always had timecode 1:00:00:00 or 00:00:00:00 in M2Edit) ("always" is meant concerning my tests with apx. 10 DVDs)
b) If I used "Step 3"-M2Vs and audio streams from Group B with the Authoring feature of IfoEdit, then the resulting delay was exactly 80ms (two PAL frames) lower than any of my entered delay tries. Seems like IfoEdit cuts two frames when authoring, same does CCE.
c) If I use "Step 5"-M2Vs of Group B (cce with 2 "cut" frames) with IfoEdits authoring feature, all is fine, resulting delay is exactly the value I entered. Seems IfoEdit then doesn't "cut" any more frames when cce already did it.

Conclusion:
a) Seems like sometimes there are two (PAL at least) frames in front of the movie, which are cut either by cce when transcoded or by IfoEdit when authored.
b) To get audio sync, just add +80ms (PAL) to the audio delay to compensate the two "missing" frames.
c) The calculated audio delay which the rippers (and dvd2avi) show is calculated with the two frames, so just add 80ms to audio delay

I now rip (and demux while ripping) the first chapter and "reauthor" it quickly with IfoEdit. If same delay comes out, it's group A, if not, it's group B. Group A: all is fine Group B: add 80ms (PAL)

Well, just statistics, maybe I'm completely wrong...(?) :rolleyes:

Matthew
3rd January 2003, 13:22
Alphaloop I agree with most of what you say, except how you should deal with transcoded streams.

I'll represent my thoughts graphically. For a film with -80ms delay:

original m2v + ac3 looks like this

audio XXXXXXXX
video AAXXXXXX

AA = 2 frames (80ms) and the reason they are dropped on a re-encode is that they are there as "filler". The video actually starts at the first X in "real terms". In other words, these 2 frames form a negative audio delay.

That means you want the re-encoded m2v to look like this:

audio XXXXXXXX
video XXXXXX

That is, you want a -80ms delay on the audio

So you should input a delay of -80 ms into IFOEdit (or in my case I'd cut 3 frames - 96ms use ac3 delay corrector, and ensure I got a +16ms delay after muxing in Maestro).

In the case of that odd +29ms (I think) delay you had that I saw in CCE forum:

Original:

audio BXXXXXXXX
video AAXXXXXXXXX

B = 29ms. Again the 2 frames = filler.

You want remuxed to look like this:

audio BXXXXXXXX
video XXXXXXXXX

So you drag audio to the right in Maestro by 29ms or enter this value in IFOEdit.

Of course this is just a theory, make be completely wrong.

Alphaloop
3rd January 2003, 15:26
Well, but with adding 80ms instead of subtracting I had perfect sync in Lethal Weapon 1 (Swiss Version). :confused: Well, maybe my ears were sleeping... ;)

Well okay, maybe I'm too fixated onto the IfoEdit authoring feature:
IfoEdit took my video, my +29ms audio, and finally made a -51ms delay. Possibly IfoEdit took both streams, aligned them by my delay, and then cut the two frames, result: The audiostream is (by value) 80ms "too early", but concerning original sync correct.

Original (A=Fill frames, B=29ms delay):

V: AA1234
A: BXxXXX


Demuxing:
V: AA1234; A: BXxXXX

Reauthoring:
1st step - Aligning:

V: AA1234
A: BXxXXX


2nd step - cut 2 fill frames:

V: 1234
A: BXxXXX


That'd explain that my +29 got -51...

Now to CCE:
Again V: AA1234; A: BXxXXX
CCE now cuts 2 frames. => V: 1234
IfoEdit -> Authoring DVD...Enter delay +29:
Now the two fill frames are already gone, so IfoEdit aligns directly at the "1", not at the "A", so you have to subtract 80ms for two frames to get the "x" under the "1":

V: 1234
A: BXxXXX


I'm more and more confused...
*doingsomemoretests*

Alphaloop
3rd January 2003, 15:57
:confused: :confused: :confused:

Why the hell is the first non black pic at the same position, when I reauthor the original videostream with IfoEdit and load it into M2EditPro? That destroys my theory concerning IfoEdit and its frame cuts. :devil:

*justmoretesting,evenwithmaestro*

PS: The two cut frames are not the "fault" of CCE. Just open the .avs into VirtualDub and you'll see that they are already there gone.

Mr Zippy
3rd January 2003, 18:09
PS: The two cut frames are not the "fault" of CCE. Just open the .avs into VirtualDub and you'll see that they are already there gone.
This brings me back to my comment about mpeg2dec not being 100% frame accurate. I have not had a lot of time to test all this yet, but try mpeg2dec2 if you get a chance.



c) The calculated audio delay which the rippers (and dvd2avi) show is calculated with the two frames, so just add 80ms to audio delay
This goes agaist what I read about DVD2AVI (I think), as the audio delay is the difference between the first video I frame and the first audio frame being played, now would the 2 blank frames be I frames ie. have a timecode?

This is getting more complicated by the day, there seems to be no definative method to 100% perfect sync - except 1:1 copy of DVD5 discs.

Maybe someone can sort out a mehtod of ripping the AC3 with the timecode still embedded, as the M2V already has a timecode embedded sync would be automatic in authoring programs. The only problem would occur when transcoding, as with these 2 possible lost frames you could end up assigning the start time code to the 3rd video frame rarther than the 1st (if 2 frames had been dropped).

Mr Zippy
3rd January 2003, 19:05
Just done a quick test on the video frame loss...

Orginal IFO for movie shows 1:30:53.16

Mehtod 1 - 1:30:53.10
Method 2 - 1:30:53.13
Method 3 - 1:30:53.16

Method 1 = Create D2V file with DVD2AVI 1.76, open in CCE with AVIsynth/mpeg2dec2.dll - read number of detected frames.

Method 2 = Create D2V file with DVD2AVI 1.76, create AVI with VFAPIConv, open AVI in CCE - read number of detected frames.

Method 3 = Demux VOB to M2V and open with DVDMaestro and read report frames.

This is interesting, if we can sort this out we can at least accuratly use the AC3 Corrector method for now.

Alphaloop
3rd January 2003, 19:52
@Mr Zippy: But be aware, that the "lost" frames aren't all at the beginning everytime. Just compare the files in M2EditPro or some other program with exact timeline and still picture preview.


BTW: Same effect like IfoEdit with DVDMaestro. I demuxed video and audio, importet them into DVDMaestro, just put them into the timeline (maximum left, no aligning), compiled it, checked delay with Tsunamis streams.exe: Result was a delay of -80ms :devil:
But same number of frames in source .m2v and in final .vob, so no frames where lost... :confused:

I guess there's somewhere something that irritates the authoring tools...

gizmau
3rd January 2003, 22:42
Originally posted by DSPguru
i once wrote a small tool that updates AC3's dialog normalization tag and then updates the crc1&crc2 tags.

could you please please please offer this tool for download, please?

Matthew
4th January 2003, 03:34
I was thinking, maybe this is all simply a result of a bug in DVD2AVI. After all, using DVD2AVI to save as a lossless avi (which bypasses mpeg2dec) results in the frames being dropped.

Lets assume that as far as DVD2AVI is concerned, those 2 frames at the beginning don't exist.

The results are the same as in my previous post, but this perhaps makes more sense.

This means that for a film with 0ms delay, where DVD2AVI doesn't like the first 2 frames, is as follows.

original m2v + ac3 actually looks like this

audio XXXXXXXX
video AAXXXXXX

AA = 2 frames DVD2AVI doesn't like.

DVD2AVI sees the original VOBs (or muxed unreencoded streams) like this:

audio XXXXXXXX
video XXXXXX

Which equates to a -80ms delay.

Now when you re-encode, on account of the DVD2AVI project file the first 2 frames are dropped. DVD2AVI didn't recognise them when calculating the delay anyway, so you want the re-encoded m2v + AC3 to look like the above.

That is, you want a -80ms delay on the audio

So you should input a delay of -80 ms into IFOEdit (or in my case I'd cut 3 frames - 96ms use ac3 delay corrector, and ensure I got a +16ms delay after muxing in Maestro).

In the case of that odd +29ms (I think) delay you had that I saw in CCE forum, the real delay is actually 109 ms.

Original m2v + ac3 actually looks like this:

audio BXXXXXXXX
video AAXXXXXXXXX

B = 29ms. Again A = 2 frames DVD2AVI doesn't like.

As DVD2AVI doesn't recognise these first 2 frames, it sees only the following, and the delay is calculated accordingly.

So DVD2AVI sees this:

audio BXXXXXXXX
video XXXXXXXXX

And so that is how you want the remuxed file to look like, as the 2 frames at the front are dropped.

So you drag audio to the right in Maestro by 29ms or enter this value in IFOEdit.

So if this theory is correct, this issue is totally separate from the timecodes one, which makes sense :)

Alphaloop
4th January 2003, 11:39
Matthew, why do you align the audio at the "A"s in the first code-example, but in "my" 29ms-example at the "X"s? ;)

Matthew
4th January 2003, 11:56
In the second example, remember, DVD2AVI sees this:

audio BXXXXXXXX
video XXXXXXXXX

And hence calculates a delay of 29 ms.

But in actual fact it actually looks like this, as the first 2 frames are not seen by DVD2AVI:

audio BXXXXXXXX
video AAXXXXXXXXX

So real delay is 29 + 80 = 109ms. So that means audio is 109 ms to right of video in original.

In the first example, on the other hand, real delay is -80 + 80 = 0ms. So that means audio lines up with video in original.

Alphaloop
4th January 2003, 12:18
BTW: Not only DVD2Avi drops the frames, also does actual VirtualDubMod, which is able to open mpeg2 vob.

Matthew
4th January 2003, 12:39
Oh okay. Well regardless of the reason DVD2AVI drops the frames, my analysis makes sense in terms of how to compensate for this "problem". Then again I would say that :D

Mr Zippy
4th January 2003, 17:35
As DVD2AVI doesn't recognise these first 2 frames, it sees only the following, and the delay is calculated accordingly.
Note that if you demux with DVD2AVI the frames are not lost the length of the M2V corrisponds with the reported length in the IFO file, therefore DVD2AVI knows those frames are there and this is used in the delay calculation, also DVD Decrypter gives the same reported AC3 delay.

The issue is establishing whether any frames at the beginning have been dropped, so that we can manually align the audio with the video in the abscence of the a timecoded AC3 output.

Another question would be is there another way to get the M2V stream into a program such as CCE for transcoding, that is 100% frame accurate?

And lets face it, if we can fix the video be 100% frame accurate during the transcode all we need for simple sync would be a way to extract the orignal AC3 with the original PTS timecode embedded.

Alphaloop
4th January 2003, 19:48
So we may be absolutely sure that DVD2Avi (and Tsunamis stream.exe, and ...) calculate the delay regarding the two frames? If that would be 100% sure, we just need to look whether two frames were dropped after encoding and compensate them with a value of 80.


I saw, that IfoEdit makes a 80ms slide to the left when authoring the original stream, so just demux first chapter, author in IfoEdit and look whether IfoEdit creates exactly same delay as you entered. If yes, no "frame effect", if no, "frame effect" occurs. Am I right...at least a little? :cool:

Mr Zippy
4th January 2003, 21:05
Sounds right to me, I have a weeks leave in work so I'll have some time this week to investigate, what I want to do is put a AC3 Delay guide on my web site when we have resolved this issue.

As I've said before if someone can write a program to demux AC3 from the VOB with the PTS timestamps embedded that would simplify the AC3 Delay further, also a way to frame serve without dropping and frames would be helpful. See below for a compartision in methods that would be required to re-author a DVD.

Now
===
1. Demux VOB
2. Transcode video.
3. Use a IfoEdit or similar to see if DVD2AVI is dropping 2 frames at start.
4. Compensate delay figure if 2 frames (80ms) dropped.
5. Use AC3 corrector to add several frames to make the delay positve.
6. Re-author - ensure you drag the AC3 forward in authoring program forward to remove postive delay created in step 3 above - 1 frame = 40ms in PAL (if required).


If AC3 timecode embedded and no video frames dropped
====================================================
1. Demux VOB to M2V and AC3 both with embedded timecodes.
3. Transcode video assigning orignal start timecode.
4. Re-author by dragging M2V and AC3 files into your timeline.

Alphaloop
4th January 2003, 21:14
I have a weeks leave in work so I'll have some time this week

You lucky one!
I have 4 exams at the end of februar. One of them is my study exam in math. :scared:


Use a IfoEdit or similar to see if DVD2AVI is dropping 2 frames at start.

Yeah, I do it this quick way:
DVDDecrypter -> only 1st chapter -> stream processing -> demux while ripping video and single audio -> IfoEdit -> Author DVD -> Enter Delay shown by DVDDecrypter -> final delay 80ms too low? 2 frames dropped, otherwise not
After checked that I start ripping complete movie.

TRILIGHT
4th January 2003, 21:56
Just to reiterate for all the newbies out there trying to learn...

All of these "extra steps" are not necessary to make a reliable working backup of your DVD. Follow the full copy guides (http://dvdguides.trilight.net) and you won't have any problems. Myself and others are available here on the forum or on IRC if you have any questions.

Alphaloop
4th January 2003, 22:06
Yeah, here is just the playground of a few nerds who have to much of spare time, who want to know why something is working...well...or why not. :D

Mr Zippy
4th January 2003, 22:26
I agree as I have not had a problem yet, but from all the details of dropped video frames and AC3 delay it is perceivable that a problem of noticable bad sync will appear, especially if the movie had a large offsets as it's suggested delay offset greater 80ms would be noticable to the human ear.

I am a perfectionist, and really you want the audio and video to be 100% in sync. I intend to put a simple guide to AC3 delay on my web site, but I still want to do some more research first.

If we can find a more accurate way to frame serve the M2V to transcode with no fear of dropped frames, then the AC3 delay corrector stage is very simple.

Demux VOB to M2V & AC3
Frame serve video to encoder
Transcode video
Change AC3 delay to positve by adding frames (32ms) with AC3 corrector
Drag M2V and AC3 into authoring program
Pull AC3 track forward to remove the postive delay created as best possible - 1 frame=40ms

Matthew
5th January 2003, 00:35
Originally posted by TRILIGHT
Just to reiterate for all the newbies out there trying to learn...

All of these "extra steps" are not necessary to make a reliable working backup of your DVD. Follow the full copy guides (http://dvdguides.trilight.net) and you won't have any problems. Myself and others are available here on the forum or on IRC if you have any questions.

Not entirely sure I agree with that as in my experience the guides don't adequately explain how to deal with audio delays. No offense, they are fantasic guides, just insufficient when it comes to non-zero audio delays. IMO anyway :)

Matthew
5th January 2003, 00:56
Originally posted by Alphaloop
I saw, that IfoEdit makes a 80ms slide to the left when authoring the original stream, so just demux first chapter, author in IfoEdit and look whether IfoEdit creates exactly same delay as you entered. If yes, no "frame effect", if no, "frame effect" occurs. Am I right...at least a little? :cool:

Well I'd disagree that IFOEdit makes an 80ms slide to the left - DVD2AVI just doesn't see those 2 frames when calculating the delay. But yeah I'd agree that if you demux the original files and reauthor them in IFOEdit or Maestro (without entering in a delay), and DVD2AVI tells you the delay is -80ms, then the drop frame problem is there.

But even if the delay is -80ms and is "normal", i.e. there are no dropped frames, then you still deal with it in the same fashion :) So you don't actually need to know whether the delay is on account of the drop frame phenomenon, unless you want to get exact chapters - in which case you'll need to subtract 2 frames from each of the chapter points :)

Mr Zippy a correction here:

"5. Use AC3 corrector to add several frames to make the delay positve."

You need to cut frames, not add them. Remember the audio starts before the video with a negative delay, so you need to cut frames so it starts after the video.

I've been doing this for months, as outlined in my first post in this thread, just follow that :)

Alphaloop
5th January 2003, 01:08
Just try it by yourself: Take one of those movies, demux video and audio of the first chapter, start IfoEdit, Author DVD, put in both streams, put in a fictitiously delay, and you'll see that the resulting delay will be 80ms less than your value (just load the resulting vob-set into dvd2avi). Whether its IfoEdits point in sliding left, or Stream's/DVD2Avi's point in seeing the delay, I don't know.

mpucoder
5th January 2003, 02:43
You're not trying to get the delay to be zero, are you? That would be wrong. Your authored DVD should have the same delay as the original.

Matthew
5th January 2003, 04:18
Originally posted by Alphaloop
Just try it by yourself: Take one of those movies, demux video and audio of the first chapter, start IfoEdit, Author DVD, put in both streams, put in a fictitiously delay, and you'll see that the resulting delay will be 80ms less than your value (just load the resulting vob-set into dvd2avi). Whether its IfoEdits point in sliding left, or Stream's/DVD2Avi's point in seeing the delay, I don't know.

Well you have to ask: why would IfoEdit/Maestro set the frames back 2? Only thing I can think of is timecodes. But when AC3 embedded timecodes are disabled in maestro, DVD2AVI still reports the -80ms delay. So I'd think that rules out the authoring application being the explanatory factor.

And mpucoder, what we are trying to do is get the effective delay on the reauthored DVD to be exactly the same e.g. with a -10ms film you'd cut off a 32 ms frame and then the delay on the file would be +22. So you'd drag it by that much to the right in Maestro. The reported delay would be different, before and after, but the sync would be perfect.

Alphaloop
5th January 2003, 10:49
@mpucoder: Yes, I always make the delay same as original. It was only an IfoEdit test to show that whatever delay you input, the resulting delay is 80ms less. I don't know why, and that makes me crazy. I check the delay of the original vob, I demux, I reauthor, I check the delay of the authored vob. It's 80ms lower in those movies. Did IfoEdit slide the audio two frames left? Or did DVD2AVI calc/report the two delays in different ways because of slightly different muxing rules? that's the questoin....

Mr Zippy
5th January 2003, 12:43
Well I'd disagree that IFOEdit makes an 80ms slide to the left - DVD2AVI just doesn't see those 2 frames when calculating the delay. But yeah I'd agree that if you demux the original files and reauthor them in IFOEdit or Maestro (without entering in a delay), and DVD2AVI tells you the delay is -80ms, then the drop frame problem is there.
I have posted this several times before, but the delay is calculated as the time difference between the first video I frame and the first audio frame, and DVD2AVI DOES calculate this correctly whether frames are dropped or not. You can verifty this by using DVD Decrypter or DVD2AVI to demux the VOB file, you'll find the output M2V has exactly the same number of frames as specified i the oringal IFO file - or am I missing something.

You need to cut frames, not add them. Remember the audio starts before the video with a negative delay, so you need to cut frames so it starts after the video.
My error, sorry your right.

You're not trying to get the delay to be zero, are you? That would be wrong. Your authored DVD should have the same delay as the original.
Getting the delay effectivly to zero by cutting frames is probably the simlest way to correct for lack of timecode in the AC3 file. Although the reported delay will be zero, the actual 1st audio frame played should be the one that would have been played at the specifed delay time.

What we need:
Frame accurrate frame serving - no dropped frames
Demxed AC3 with embedded timecode

mpucoder
5th January 2003, 16:03
This thread is going so far away from the truth that I have been reluctant to participate. I dislike taking people to task, but I must. PTS is a timestamp, it is NOT the timecode I referred to in audio and video streams. That timecode is seperate, PTS is derived from it. PTS is an MPEG timestamp, and, therefore, does NOT appear in a properly demuxed AC3, DTS, or LPCM stream. These streams are not MPEG streams, but DVD extensions, so they ALL appear as a privately defined data object in private stream 1.

While the AC3 timecode is optional, it is not an extension (that is it takes no additional bits), so it would be highly unlikely that demuxing the stream would remove it. I've never seen it disappear. However, there will be no PTS to compare it to for offset, that must be done in a system stream, such as a vob file.

The "audio delay" is a measure of how early or late the audio start is relative to the video, it is not pertinent to DVD muxing, but only to avi. It is normal for one stream to start before the other, lining them up will introduce sync loss in such a case.

Think about this: the DVD plays fine with the "audio delay" being non-zero. What is more logical, to duplicate the original conditions, or to strive for what you perceive as perfection, even though you don't understand the basic concepts of MPEG?

Alphaloop
5th January 2003, 16:35
@mpucoder:
So please be so kind to say how would you handle this:
A movie, ripped in IFO Mode with DVDDecrypter. The info files reports that the audio stream has a delay of +17. Demux audio for later use. Start DVD2Avi, create project, AviSynth, load into CCE, encode. Now I have a reencoded .m2v and an .ac3 file. I start IfoEdit, Author DVD, put in both streams, set the delay +17 into the delay field, and wait until IfoEdit finished. Am I right with these steps? Did I make any mistake?

Now the problem: what if the cce encoded video stream has two frames less at the beginning? Nevertheless use +17?

mpucoder
5th January 2003, 16:40
I can't comment on any process that uses frame serving. I've never used it.

Alphaloop
5th January 2003, 16:45
Well, okay, then just from starting point: A DVD, to be backuped movie only, is ripped in movie mode and showed a delay of +17. The movie is too big, has to be transcoded by cce...

Mr Zippy
5th January 2003, 17:48
While the AC3 timecode is optional, it is not an extension (that is it takes no additional bits), so it would be highly unlikely that demuxing the stream would remove it. I've never seen it disappear. However, there will be no PTS to compare it to for offset, that must be done in a system stream, such as a vob file.
I do understand this, but looking at the asset properties for the M2V and AC3 streams in DVDMaestro, the M2V stream shows an offset which I belive is the start timecode, yet the offset box is blank on the AC3 stream properties.

I have take this blank offset as meaning no timecode is present, also if I re-author and demux I get the same -80ms delay whether DVDMaestro is set to ignor AC3 timecode or not.

If the AC3 stream has no timecode, as I believe, is there a way to tell DVDMaestro the start timecode for the audio? I have looked in Sonic Sencarist, which is too complaicated for me, but it looks like you can add the start timecode for the AC3 track.

mpucoder
5th January 2003, 17:58
@Alpha - I understand why frameserving is used. I just don't do it. There are other ways to transcode with CCE.

@MrZippy - show me the first 20 bytes of an AC3 stream, and I'll show you the timecode. The problem I see here is no one is bothering to look up specs, or visit info pages, but trying to reverse engineer everything by way of observation of program behaviour. At least look at the files with a hex viewer.
Then have a look at some info, such as www.mpucoder.com/dvd/ and, especially for AC3, look at http://www.atsc.org/standards/a_52a.pdf

Mr Zippy
5th January 2003, 18:06
Ok, I admit I am possibly looking for a quick fix without reading the background info. As I said yesterday I have a weeks leave this week, so I'm going to spend some time looking into this.

So are you saying the demuxed AC3 does have a timecode?

If so, why when re-authoring M2V and AC3 streams in DVDMaestro is the output file when demuxed got a different delay? If the timecodes were present the delay should be exactly the same.

What I'm thinking is the orignal AC3 used to author the movie had a timecode, but this timecode was just used to align the audio using the PTS code, when demuxed the AC3 has no timecode as it was never embedded in the movie.

I understand why frameserving is used. I just don't do it. There are other ways to transcode with CCE
What other methods?

Matthew
6th January 2003, 00:56
"What other methods?"

Perhaps he means loading in an avi. Although saving an avi from a vob using DVD2AVI = 2 frames lost as well.

Matthew
6th January 2003, 03:30
mpucoder the problem with background technical information on a topic like this is that it is difficult to understand, at least in my case :D

Also, taking people to task is a good idea, you are doing the person/people a favour :) I know I like to be told I'm wrong if, I am indeed wrong :) But you have to destroy them point by point :D

Anyway, in regards to this remark by you:

"The "audio delay" is a measure of how early or late the audio start is relative to the video, it is not pertinent to DVD muxing, but only to avi. It is normal for one stream to start before the other, lining them up will introduce sync loss in such a case."

What I am trying to do is make it so that the streams, in effect, line up as they did in the original DVD.

Because as I understand it, just chucking them in Maestro means the streams are lined up, like you say they shouldn't be.

Do you dispute that if DVD2AVI reports a delay of 20 ms, say, it is wrong to ensure the remuxed file has a 20 ms delay by dragging to the right in Maestro? If the delay is measured as the time taken between when the first video frame is played and the first audio frame is played then how can this be wrong?

You yourself said earlier in this thread "Or disable timecodes and slide the audio around on the timeline by the delay value."

Well, if this dragging of the audio to the right is acceptable, how is that different from achieving sync on a negative audio delay by cutting frames. As you can't drag to the left of the video stream in Maestro, you need to remove the gap by cutting frames.

i.e.

audio XYZ
video YZ

is the same as the reauthored:

audio YZ
video YZ

except you are missing part X of the audio as you've cut it out..and it ain't noticable.

And Mr. Zippy, back to the question of whether DVD2AVI takes account of those 2 frames at the beginning. Well I tried a few DVDs, and of the ones that were 0ms according to DVD2AVI, none had dropped frames at the beginning when re-encoded. A couple had a -80ms delay and those lost the first 2 frames on re-encoding. Just appears as though DVD2AVI (and DVD Decryptor, etc) output delays that treat those 2 frames as not existing (for whatever reason) rather than authoring progs mysteriously shifting the audio.

Alphaloop
6th January 2003, 11:26
Today I experiences a weird thing: After trying many PAL movies, I tried a NTSC. It also had the frame issue. I ripped it, DVDDecrypter reported delay -67. Took both original streams into DVDMaestro, just dropped them into the timeline, compiled the project, and tested the delay. It came out with -67, and perfectly in sync.

Seems that all my problems are concentrated on PAL movies, so it's not surprising that so many people here haven't any sync probs, because they mostly do NTSC.


@mpucoder

Your authored DVD should have the same delay as the original.

Only two questions for understanding concerning those movies with the dropped frames issue:
If I take the original demuxed stream to reauthor it in IfoEdit or DVDMaestro, then I have to (disregarding what the auhtoring programs really does) enter a (corrected, if necessary) delay so that the reported delay of the final dvd-structure is the same like the one reported of the original dvd?
Now I have reencoded the stream, resulting in a stream that has two frames less at the beginning. Do I have to take care of the 80ms (2 frames PAL) in aligning the delay to the original vob? Now I actually have to work like already the original vob has two frames less at the beginning, ergo: like the original vob has 80ms more delay in it?

It's weird that it seems to function automatically with NTSC, but not with PAL movies. :confused:

TRILIGHT
7th January 2003, 00:09
Originally posted by Alphaloop
It's weird that it seems to function automatically with NTSC, but not with PAL movies. :confused:
Now this would make a LOT more sense considering myself and everyone I know works with NTSC material. Honestly couldn't tell you the first thing about PAL. However, from my understanding, PAL framerate is 25fps though I've seen people say to just use the encoded video as is which really is at Film speed of 23.97fps. Could it be the discrepancy in these two framerates that is really at the heart of your problem? Just a thought. ;)

atreides93
7th January 2003, 00:24
Originally posted by mpucoder

Think about this: the DVD plays fine with the "audio delay" being non-zero. What is more logical, to duplicate the original conditions, or to strive for what you perceive as perfection, even though you don't understand the basic concepts of MPEG?

Mpucoder,

whoah you've made me wonder about how I'm backing up dvd's now! maybe i'm doing it wrong!

This is what I do, please tell me if this is wrong.

I re-encode the entire movie using dvd2avi to avisynth to cce 2.50

I demux the AC3 file with dvd2avi

I use ac3delay to adjust the delay (whatever dvd2avi said the delay was). ac3delaly automatically grabs the correct value from the file name.

I then take these two files the m2v file and ac3 file and mux them with SpruceUP or Maestro. I don't do anything else with the ac3 file delay, i just lign it up with the video.

So according to you I shouldn't be doing the ac3delay step?

Mr Zippy
7th January 2003, 00:32
I am also only doing PAL movies, maybe it's a problem with the demuxing software when it comes to PAL movies.

I cannot believe it is Maestro of Senarist as they are professional programs that are designed for PAL and NTSC.

Hopefully we will find a simple AC3 solution, as just dragging freshly demuxed M2V and AC3 files from a PAL DVD into Maestro does not give the correct original delay, as it has been said NTSC does.

benf2
7th January 2003, 00:44
:( My demons are when the ac3 starts to slowly become out of sync 2/3 into the movie...the only thing i havent tried, which someone mentioned in a thread is to change the video framerate in the avs script and not to use pulldown...(i do ntsc movies) then just import into maestro as usual.

atreides93
7th January 2003, 01:19
benf, how often does that happen to you where you see it lose sync later on in the movie?

I did a rip of Airforce One and it appears to be in sync up to the end of the movie. Its NTSC

benf2
7th January 2003, 01:49
too many...i usually windup trashing the movie cause i get frustrated with it. All that time encoding wasted:mad:

I probably have 100+/- movies remuxed to dvd and i would say appx 25-30 i had problems with audio sync.

I tried using the ac3 file from smartripper, dvd2avi, vstrip...same problem. Thats why i am starting to think it has to do with the m2v file that was encoded in cce.

gizmau
7th January 2003, 02:00
@benf2
when all those movies were encoded/authored on the same machine, then i suggest a hardware related problem rather than a bad working program.

when you rip the dvd and demux the ac3, drag it into besplit/besliced and select 'fix' - are the sync errors reported? if so, then your ram modules (i believe that there are at least two different modules in the slots, isnt it? ;-) ) produce this, at least in 99% of all cases...

afaik, these corrupted frames are dropped during decoding/transcoding with besweet, therefore drifts the stream out of sync.

Matthew
7th January 2003, 02:43
Originally posted by Alphaloop
Today I experiences a weird thing: After trying many PAL movies, I tried a NTSC. It also had the frame issue. I ripped it, DVDDecrypter reported delay -67. Took both original streams into DVDMaestro, just dropped them into the timeline, compiled the project, and tested the delay. It came out with -67, and perfectly in sync.

Seems that all my problems are concentrated on PAL movies, so it's not surprising that so many people here haven't any sync probs, because they mostly do NTSC.

2 frames were dropped right?

Well 1/25 * 1000 * 2 = 80ms (PAL)
1/29.97 * 1000 * 2 = ~67 ms (NTSC)

So I think what happened with your NTSC DVD is no different from what happens with the -80ms PAL DVDs with 2 dropped frames.

The real test would be to have an NTSC DVD with an unusual delay :)

BTW TRILIGHT that comment about the encoded video speed being 23.97fps is probably because the mastering places often will create a PAL DVD by speeding up the (NTSC) video. That's why a PAL DVD is often shorter than the NTSC equivalent (and the video moves !4 percent quicker). But the video on the DVD is indeed 25 fps :)

Alphaloop
7th January 2003, 10:52
Soon we'll win the Doom9-Trophy for the longest thread. ;)

Sorry, I only have three NTSC-DVDs here (3 hentais :D). Two of them have delay 0 and no frame issues, the third is my only test example which I own.

The only facts that interest me at the moment are:

-When calculating the delay, is DVD2Avi comparing first audio frame with first video stream frame (means first of the two fill frames), or with "first movie frame" (means disregards two fillers and takes the third frame) (My guess: first stream frame (filler))
Ergo: Whatever the authoring programm changes the delay itself or whatsoever, just enter a (corrected) delay, so that the final delay matches the original delay

-when cce is cutting the two frames, will i have to include that "gap" into my delay calculations for auhtoring to compare with original delay? Means: Original delay is calculated (1st audio frame):(1st video frame [=filler]). Now first two frames are gone, I have to play with a 80ms (PAL)/67ms (NTSC) bigger delay in my authoring attempts when comparing with the original, so make my delay match the original delay minus 80 (or 67). :confused:

Matthew
8th January 2003, 02:54
Alphaloop, as you know I think DVD2AVI does not see those 2 frames for purposes of reporting delay.

tateu's post here provides evidence in favour of that, on a technical basis.

http://forum.doom9.org/showthread.php?s=&threadid=30895

Notice that the difference in delay values (+32 and -34) is equal to 2 NTSC frames.

I don't understand it all, but the basic gist of it is that often DVD2AVI does not take into account the first 2 frames when calculating delay. And it appears that in these cases the 2 frames are dropped when re-encoding. So we want to obtain an effective delay equal to that specified by DVD2AVI, not one that is different by -80ms.

Here's 2 cases, one with a delay of +29 and one with -102, both with 2 dropped frames and PAL.

Re-encoded streams treatment:
-----------------------------

1. DVD2AVI should actually report delay as 29+80 = 109ms
But 2 dropped frames after re-encoding means that delay should be reduced by -80 ms also. Result is we want an effective delay of 29ms. Which is what DVD2AVI reported in the first place. So we input that in IFOEdit or drag by that much to the right in Maestro.

2. DVD2AVI should actually report delay as -102+80 = -22ms
But 2 dropped frames after re-encoding means that delay should be reduced by -80 ms also. Result is we want an effective delay of -102ms. Which is what DVD2AVI reported in the first place. So we cut off 4 frames (128ms) and drag by 26ms to the right in Maestro (or simply input -102 ms in IFOEdit).

Unre-encoded streams treatment
------------------------------
1. DVD2AVI should actually report delay as 29+80 = 109ms
So we input that in IFOEdit or drag by that much to the right in Maestro. DVD2AVI would then report +29 ms delay(109-80).

2. DVD2AVI should actually report delay as -102+80 = -22ms
So you'd cut off 1 32 ms frame and then drag it to the right by 10 ms in Maestro. Or just input -22ms in IFOEdit. DVD2AVI would then report your delay as -70ms (10-80, or -102+32) if Maestro were used.

So what I stated originally still seems to hold up in regards to the whole dropped frames thing. If my method is wrong (and it may well be), it's wrong for other reasons :)

Alphaloop
8th January 2003, 15:59
Well, Matthew, that provides evidence for my "theories":


(Un-reencoded)
1. DVD2AVI should actually report delay as 29+80 = 109ms
So we input that in IFOEdit or drag by that much to the right in Maestro. DVD2AVI would then report +29 ms delay(109-80).

Adding the 80ms to compensate the 2 frames when auhtoring in IfoEdit. On page 4 of this thread you contradicted. ;)

I already did that (adding 80ms) when trying to sync Lethal Weapon 1. And the result was: perfect sync.

conclusion(?):
When handling unreencoded streams, play around with delay until the final delay dvd2avi reports matches the original delay (should be at least after second try ;) )

When handling with reencoded streams, jsut use the delay dvd2avi reports.

TRILIGHT
8th January 2003, 17:41
I've changed the name of this thread to something more appropriate. Too many NTSC users who have no problem at all are becoming confused and subsequently screwing things up that would otherwise have been fine.

Matthew
9th January 2003, 00:02
Alphaloop, on page 4 I was referring to re-encoded streams. In that case you wouldn't add the 80ms as it is offset by the 2 frames being dropped ;) With unre-encoded streams I always agreed with inputting the delay into IFOEdit (or Maestro) such that the delay reported by DVD2AVI was the same on the original and remuxed copies. (Hell, I did that on a reauthored DVD-R before this discussion even started). What I disputed was the that 1) the authoring programs were making adjustments equal to two frames (they weren't, it's just that DVD2AVI doesn't include them), and 2) that in the case of re-encoded streams, that a further adjustment had to be made because of the 2 dropped frames (it doesn't as DVD2AVI doesn't factor them in).

TRILIGHT: out of interst, how do you judge whether a release has perfect sync? Using your ears, or DVD2AVI or what? After all, I don't see how timescodes could be retained with NTSC after the video stream is re-encoded.

Mr Zippy
9th January 2003, 15:46
I am lost here, what makes you think DVD2AVI does not take account of the two possibled dropped frames when working out the AC3 delay?

The M2V file that is demuxed has no missing frames, and I have explained and posted a link to how DVD2AVI works out AC3 delay.

Matthew
10th January 2003, 00:32
Put simply, DVD2AVI takes the PTS value from the first i-frame and then subtracts this from the PTS value for the first audio frame in order to get the delay.

Often the first i-frame is not the first frame in the stream, but rather the third frame. Hence the previous 2 frames are not taken into account by DVD2AVI.

Obviously for encoding purposes the first i-frame is considered the starting point as well, that's why the frames before the first i-frame are dropped.

You can verify this by opening the vob or original video stream in womble mpeg editor. If you drag the slider along it only stops at i-frames. And the first stopping point corresponds to the third frame, in those dropped frame cases ;)

BTW as a side note seems that the timecode in Maestro is taken from the first i-frame, not the first frame in the stream. The timecode in Maestro matches that of the first i-frame (obtained using bitrate viewer), even when the first i-frame is the 3rd frame ;)

Alphaloop
10th January 2003, 00:41
Please confirm, whether it's just my narrow statistic, or a real "rule":
Start BitrateViewer, load the Vob, click on GOP.
Movies with the frame issue have the starting GOP like IB... (I frame followed by one/two B frames), movies without the "problem" have the first GOP like IP...(I frame followed by one P frame).

Matthew
10th January 2003, 00:50
Well I just tried what you said on a couple of movies, and it appears that what you say is indeed the case. I presume you just see this as a convenient way of detecting whether a film's first i-frame is the third frame?

Alphaloop
10th January 2003, 01:01
I presume you just see this as a convenient way of detecting whether a film's first i-frame is the third frame?

If it's not just a statistic error but a real rule of the effect, it would save lot of time, 'cause I (we?) could avoid remultiplexing first chapter with IfoEdit, comparing original and reencoded video with M2Edit (difficult with fade-in starts), or some other games... ;)

mpucoder
10th January 2003, 01:17
Something I don't get about this latest:
In DVD every GOP must start with an I frame. Not only must it be first in temporal sequence, but first in the stream. Until an I frame is encountered there is no reference for P or B frames.
Also B frames must be preceeded by two reference frames, usually an I followed by a P. Unless the GOP is "open" those frames will be in the same GOP, encoded before any B frames.
And, finally, the first GOP of a movie should be closed (how can it reference a prior GOP?).
So, how can the first GOP have the sequence "IB..."? That would indeed be a problem for decoding, no forward reference frame.
If this is the case, what you're saying is a large number of PAL movies are being encoded improperly.

Please make sure you are looking at the encoded frame order, it is not the same as the decode order (which is defined by the "temporal sequence number")
Typical encoding is IPBBPBBPBBPBB, but gets decoded as IBBPBBPBBPBBP (temporal sequence 0, 3, 1, 2, 6, 4, 5, 9, 7, 8, 12, 10, 11)

Matthew
10th January 2003, 01:29
mpucoder, I can't explain it as we are just looking at what bitrate viewer spits out (only one column called "pictures", and btw the first gop is reported as closed), except I'll just add that there was a case earlier in this thread where Alphaloop had a delay of -67 ms reported on a NTSC title. By my calculations that is 2 NTSC frames, which indicates that the 3rd frame thing (and hence this GOP thing) may not just be a PAL phenomenon.

Alphaloop, that's what I meant. Except I think it is even easier to use womble. Just dragging a vob into womble and using the slider will tell you in under 5 seconds where the first i-frame is. No comparison is necessary =)

edit: can paste results from IFOEdit "check gop structure" if you like, but you'd need to say which boxes to check (just i frames, or i, p and b).

mpucoder
10th January 2003, 01:49
You can use VobEdit to see the encoded frame order. If it is IBB... then there aren't many options for handling the 2 B frames. Either remove them, or replicate the previous frame. It sounds like DVD2AVI is dropping them.
I'm curious who is making these DVDs.

Trilight changed this to PAL only, but I'll answer the question about NTSC frames. They are approximately 33.37ms long, but 2 progressive frames (23.976fps) should be displayed as 5 fields (every other progressive frame has the rff flag set if pulldown was down right). That means 2 frames should be 83.4 ms long. Something to watch out for.

Matthew
10th January 2003, 01:57
It is indeed IBBP accoridng to vobedit.

mpucoder
10th January 2003, 02:00
Ewwww. Can you check the temporal sequence numbers? maybe the encoder put the frames in the wrong order for streaming.

Matthew
10th January 2003, 02:08
2, 0, 1, 5, 3, 4, 8, 6, 7, 11, 9, 10

BTW I scrolled right down and repeated this with another random GOP and the numbers/order was the same. Don't know if that means anything.

mpucoder
10th January 2003, 02:23
That is really messed up, but dropping frames 0 and 1 is the only thing a decoder can do. So it looks like, for these movies, you're doing the right thing to compensate.
What studio is making these? Maybe it's just one production house or studio.

Matthew
10th January 2003, 02:35
2 titles I can mention off hand are Brassed Off and Best in Show (I'm in region 4 BTW).

One is Mirimax, the other is WB/Castlerock.

Another one I had was the Best Bits of the Late Show, which was independently produced.

Doesn't seem to be a pattern there.

mpucoder
10th January 2003, 02:52
The PTS value and timecode apply to frame 0 of the GOP (which should be an I frame, but...), which explains why 80ms gets lost for PAL movies like this.
One thing that could be done to preserve the timing is replace frames 0 and 1 with black. Since DVD2AVI is open source, maybe someone could modify it to do this.

Matthew
10th January 2003, 03:37
Well having to cut off a couple of frames of audio doesn't do any harm =) Even with that fix, adjustments would need to be made anyway with many films, e.g. on one DVD I had the -96 ms delay would become -16 ms and so it would be necessary to cut one frame of audio and drag to the right by 16 ms.

Just as a postscript: in order to get exact chapters, chapter points as listed by chapterxtractor should be shifted to the left by 2 frames =)

Alphaloop
10th January 2003, 10:28
I also tested some with vobedit. Same here, movies without the frme issue have IPxx, movie WITH the frame issue have IBxx.

Which had the issue (tested also dvd library of my neighbor ;) ): 95% of the WB titles, a few Columbia Tristar. Best thing was my cool Devices 3DVD Set: 11 missions all together, 10 are okay (IPxx), one within (mission 9), has "IBB IBBPxxx" (3 pics 1st GOP, then second). nd it's NTSC! :D

But knowing when it happens, and why it happens, is very calmative, 'cause you then know how to bypass sync problems...

Mr Zippy
10th January 2003, 19:39
This is really starting to go over my head now.

Maybe someone will write a nice guide to AC3 sync when re-authoring DVDs, am I right in thinking if we can establish the correct audio offset delay then the AC3 Delay Corrector and dragging forward in the timeline is surely the best method. Unless we can find a way to put a start timecode in the AC3 or the authoring program - which I think you can in Scenarist.

Matthew
12th January 2003, 03:03
Mr Zippy, the method I outlined would seem to be fine - given that timecodes are disabled, getting the sync right at the beginning is the way to go (like with avi). So there is your guide (my first post in thread).

BTW an alternative to cutting audio with ac3 delay corrector is to insert frames into the re-encoded video stream using m2edit. e.g. for a -102ms movie you could insert 3 frames (120 ms) and then drag to the right in Maestro by 18 ms :) I'll just stick with cutting audio though as it is easier :) Unless perhaps it would be easy to add frames using avisynth, as part of the encoding process.

Mr Zippy
12th January 2003, 04:08
I followed that and like the Delay Corrector method, what has lost me is the talk of dropped frames on some movies and the fact that the quoted delay may be incorrect in these cases.

Matthew
12th January 2003, 05:34
Well ditching the theory, the practical implications of the dropped frames are usually insigificant. I assume that's what you are concerned about - how it affects what you should do.

Regardless of whether there are dropped frames, when re-encoding the video stream, just rely on the quoted delay. So follow the method as I described early in the thread and it'll work out.

If you are not re-encoding the video stream (a rare event I imagine), then do the following:
-Do a partial mux of the video and audio streams without making any adjustments.
-If DVD2AVI reports a delay of -80ms on the muxed streams then add that to the delay reported on the original DVD. e.g. (1) -80 ms becomes 0ms and e.g. (2) +29ms becomes 109ms and e.g. (3)-100ms becomes -20ms
-In example 1 you'd drag the audio 0ms to the right, i.e. by nothing and according to DVD2AVI the muxed copy would have a delay of 0-80 = -80ms.
-In example 2 you'd drag the audio 109 ms to the right and you'd want DVD2AVI to report a delay 109-80=29 ms.
-In example 3 you'd take your -20ms and make it positive by cutting the the smallest number of frames, i.e. 1. Your delay is now +12 ms. So drag it by that much to the right in Maestro. You want DVD2AVI to report a delay of 12-80 = -68.

Hope that makes sense :)

Alphaloop
12th January 2003, 11:06
I play around with unencoded streams, because I reassemble a few series DVDs. So for instance I backup my Cool Devices 3 DVD Set, where I have to reassemble each 4 episodes on one disc (and avoid to split the double episode between two disc like in original), and do that without reencoding.

I continue identifying frame issue movies this way: Rip/Demux video and audio of first chapter, start IfoEdit, Author DVD, select both streams, enter any test delay (+17, -23, what you want). If the final delay which DVD2Avi reports is exactly this value, then no frames are dropped. If the reported delay is 80ms less, then 2 frames got lost, and you have to copensate with 80ms (PAL).

But this is all theory for handling with unreencoded streams. Most time you have reencoded streams, there you just use delay value what DVD2Avi shows of the original vob for reauthoring.

xkenshin55
17th January 2003, 04:33
I didn't read through entirely so I'm jumping in to put in my two cents on how i fix desynched audio. I know my method is about divx and wav audio, but it might work with DVD also. I'm learning as much as I can to rip and do some DVD authoring, so.. here's the method I use.

With the Video and Audio, calculate the length of each in ms (milliseconds).

Next, simply do the math. Subtract one from the other and you'll come up with two values, one negative and one positive.

Now, in Maestro, input the value and it SHOULD fix something.

I'm not totally sure this will work. Because it works when I have desynched a divx file and an wav/mp3 file. I do that method I just described and it fixed my problem.

Hope this helped. I knew to DVD authoring so... I only pray this method works! Oh, and isn't there a way to reset all PTS points in the video and audio? I read somewhere in this thread that you can select Maestro to either use the PTS or not.. *shrug*

Kx5

mpucoder
17th January 2003, 04:57
OK, seems like I misinterpretted the spec for mpeg2, and so, apparently, did the author of dvd2avi. A closed GOP can indeed have B frames as frame 0 and 1. Take a look at http://forum.doom9.org/showthread.php?s=&threadid=43206

Does anyone know if this has been discussed in the dvd2avi forum? I don't follow it closely.

Mr Zippy
23rd January 2003, 00:30
Originally posted by Matthew
Regardless of whether there are dropped frames, when re-encoding the video stream, just rely on the quoted delay. So follow the method as I described early in the thread and it'll work out.


Sorry I'm lost, why would I not need to worry about the possible dropped 2 frames if I re-encode?

Surely if the frames have been dropped, then re-encoding will make no difference there will still be a 80ms difference between the corrrect delay, and what you have.

I still maintain if we can either get a timecode based on the orignal PTS into the AC3 file, or specifly the start timecode for the AC3 then there would be no problem.

Keeping the correct timecode is simple for the video if you re-encode, you just enter the start timecode in CCE for example. The only issue would be again whether 2 frames have been dropped or not.

Oh well, I have my DVD Writer now... Hopefully I will not have any sync problems. Although I would like to know any movies I backup are 100% in sync.

It would be nice if someone wrote a guide for AC3 Sync when backing up movies as this seems to be overlooked by all guides I have read.

Also we really need an updated DVD2AVI or a framesever that does not drop frames.

TRILIGHT
23rd January 2003, 01:07
Originally posted by Mr Zippy
It would be nice if someone wrote a guide for AC3 Sync when backing up movies as this seems to be overlooked by all guides I have read.

I think a great number of us only work with NTSC material and have never had a sync issue. This is probably why you find that no one references it. It's just not an issue for us and we have no way to test. Perhaps you can get with some of your informed PAL colleagues and come up with a solution. Those of us in the NTSC world won't be of much help to you.

Mr Zippy
23rd January 2003, 01:14
Hopefully more PAL users will be on the scene soon....

Matthew
23rd January 2003, 01:29
"Sorry I'm lost, why would I not need to worry about the possible dropped 2 frames if I re-encode?

Surely if the frames have been dropped, then re-encoding will make no difference there will still be a 80ms difference between the corrrect delay, and what you have."

Because DVD2AVI does not take account of these 2 frames when calculating delay, they being dropped in the re-encoding process doesn't matter. The 2 effects cancel each other out. i.e. DVD2AVI reports a delay of -80ms when it should report a delay of 0ms. Lets assume for a moment it did report the delay correctly - as 0ms. 2 frames are dropped when re-encoding, meaning that the audio file should start 80ms before the video, i.e. a delay of -80ms. Which is what DVD2AVI does report.

"I still maintain if we can either get a timecode based on the orignal PTS into the AC3 file, or specifly the start timecode for the AC3 then there would be no problem."

You can cross your fingers about that if you like, personally I don't care. Lining up the streams correctly at the beginning will ensure correct sync througout the movie. So what if I have to cut off a couple of blank audio frames at the beginning. If you are worried about that then you should be much more worried about the quality loss associated with re-encoding the video stream.

"Also we really need an updated DVD2AVI or a framesever that does not drop frames."

Yes that would fix the problem. Not that it is a big deal though (although it can be annoying if remuxing re-encoded credits or something like that). You could use REMPEG2 of course ;) Or add 2 black frames after the fact using M2Edit.

Losing a couple of black frames and a couple of blank audio frames at the start of a movie - equivalent to a fraction of a second - is nothing compared to copping a quality hit when re-encoding the video stream.

And I don't understand why this would be a PAL-only issue, hence I'm not convinced that is the case :)

TRILIGHT
23rd January 2003, 01:46
Originally posted by Matthew
And I don't understand why this would be a PAL-only issue, hence I'm not convinced that is the case :)

I'm pretty convinced. My many backed up DVD's are convinced. Many other NTSC users who have followed the guides seem convinced. hehehe ;) Sucks that PAL users have to deal with it but it sucks for us that NTSC users have to deal with pulldown and drop-frame issues that PAL users do not. Such is the nature of the beast. ;)

Matthew
23rd January 2003, 01:58
I agree it's good us PAL users don't have to put up with those NTSC issues of pulldown etc :)

But I'd like to see someone check whether 2 frames were dropped on some of their NTSC DVDs (specifically those with negative audio delays). It's not hard to check after all :) There doesn't seem to be any theory as to why this would be only a PAL issue.

And the fact remains that when there is an audio delay, on re-encoded streams the timecode has to be lost. So how can the streams be in sync without user intervention, whether PAL or NTSC.

benf2
23rd January 2003, 02:39
i would say i can only partialy agree with that statement...i only do ntsc and sometimes i come across an async issue where the audio if fine for the 1st 2/3 of a movie and slowly goes out of sync...i think correcting this is the hardest of all.

TRILIGHT
23rd January 2003, 02:47
Originally posted by Matthew
So how can the streams be in sync without user intervention, whether PAL or NTSC.

Don't know. It just is...every time. :) I think what it MIGHT be is that the clock is set to all zeros in CCE for the encode. The timecode in the audio files knows to delay by a certain amount from that number so it's always in sync since the audio timecode is never touched.

It also has a bit to do with the framerate I would imagine. I mean, with NTSC material, it is common practice to edit everything using drop-frame timecode. When we author and do the pulldown, setting the drop-frame flag for our video, the clip probably lines up just the way it did originally because the audio was created using drop-frame timecode originally and we made our video drop-frame also after the pulldown to 29.97fps.

From my understanding, PAL users do not even touch their video framerate. Instead they leave it as it is encoded at the FILM framerate. Since your original audio was authored in the process using the *real* PAL framerate of 25fps (I think that's what it is, right?) then when you try to put it together again, it does not match as it did originally. The timecode becomes different and therefore the audio gets out of sync with the video you authored.

As for your concern about 2 frames at the beginning.... I honestly don't know. Perhaps they are there. However, I am more concerned with whether my final product is going to be usable or not. Not whether a frame or two is missing at the very beginning. Afterall, when talking about 30 frames being displayed on the screen every second... I don't think anyone could see whether there were 2 frames there or not at the beginning. I think that works out to be roughly 7 hundredths of a second? Perhaps my audio is off by that much throughout the movie? Maybe. It honestly does not matter to me at all though because I can't tell and I doubt any human could.

TRILIGHT
23rd January 2003, 02:50
Originally posted by benf2
i would say i can only partialy agree with that statement...i only do ntsc and sometimes i come across an async issue where the audio if fine for the 1st 2/3 of a movie and slowly goes out of sync...i think correcting this is the hardest of all.

What you are describing is a drop-frame problem you set incorrectly. It's the case everytime when things get progressively out of sync since drop-frame is 29.97fps and non-drop is 30fps. Starts off fine...is off by 1 second after 30mins of video....2 seconds by 1 hour of video...etc.

benf2
23rd January 2003, 03:01
what u say makes sense, i guess somewhere along the line i missed how i would detect that the movie is drop frame...i dont think i have used that setting in cce at all...(i guess its apparent);)

so my question is how do i detect before i encode that i need to ck the box drop frame?

TRILIGHT
23rd January 2003, 03:06
You must be using a different version of CCE. I encode the video and then use pulldown.exe for performing pulldown and setting the drop-frame flag on the encoded video. Please post in a new post though if you have drop-frame questions, benf2. These guys are trying to figure out their sync problem on PAL stuff and what you're talking about is not applicable.

Matthew
23rd January 2003, 03:06
Most of what you just said went over my head but maybe that does explain it :) I take it you've obtained the audio delay on the re-authored vobs using DVD2AVI?

In regards to the 2 frame thing, I certainly don't care about the loss of 2 frames per se, but a desync of 80ms (67 ms for NTSC) can be noticeable :)

Alphaloop
23rd January 2003, 10:26
Here I have one example for the 2 frames issue in NTSC:

Cool Devices 3 DVD-Set US-Version, Operation 9, "Slave Warrior Maya II".
Loaded it into Womble MPEG2VCR, first nonblack pic is #9. Loaded it into VDub via DVD2Avi/AviSynth, first non black picture is #7.

Any explanations? ;)

Mr Zippy
23rd January 2003, 13:51
Originally posted by TRILIGHT
Don't know. It just is...every time. :) I think what it MIGHT be is that the clock is set to all zeros in CCE for the encode. The timecode in the audio files knows to delay by a certain amount from that number so it's always in sync since the audio timecode is never touched.

What makes you think the AC3 file has a timecode, I can find no evidence of this, Scenarist and DVDMaestro report nothing in the AC3 offset box, whereas the video offset shows the actual start timecode entered in CCE whether it's all zeros or not, and it makes no difference if you tell DVDMaestro to ignor AC3 timecode.

Also the delay cannot be relative to a zero timecode, as many DVDs do not start the video timecode at zero.

Originally posted by Mattew
Because DVD2AVI does not take account of these 2 frames when calculating delay
From what I read DVD2AVI looks at the first audio frame and the first video I frame to calculate the AC3 delay, am I to take it that in the case where frames are dropped the AC3 delay is being calcualted from the first video frame that would be frame served, and not the first video frame in the output demux M2V file?

Originally posted by Mattew
In regards to the 2 frame thing, I certainly don't care about the loss of 2 frames per se, but a desync of 80ms (67 ms for NTSC) can be noticeable
This is exactly why I want a fool proof method for 100% audio sync, I don't want to have to play back in my DVD player to discover the sync is wrong. For a example we use the Bitrate viewer before encoding to encsure the field order is encoded the right way round for TV playback.

LeXXuz
23rd January 2003, 21:33
Hi guys!

I just read this thread and it gaves me a big headache. ;)
I'm also a PAL-only user and recognized same sync problems.
I also check every DVD manually after authering for sync and often recognized they are NOT. So I have to fix it manually.
I use following method for reencode:
DVDDecrypter => DVD2AVI => Avisynth (mpeg2dec2) => cce
I never thought of the 2-frames-drop issue, but it might be the reason why my dvds are sometimes sync and sometimes not.
I'll test that frame-drop problem when I have a little bit more time....
There must be a way to get this sync-issue lost! :mad:

TRILIGHT
23rd January 2003, 22:19
@Lexxuz

Don't waste time with drop-frame. This is purely an NTSC issue and does not apply to you. Also, the source of your problem is not the 2 frames.

@Zippy

You're kidding yourself if you don't believe audio and video is edited and originally authored on DVD without timecodes. Even though I'm not a PAL user, I've suggested common sense probable causes but I really don't see anyone doing any REAL trial-and-error work and saying "I did this and it gave me this. I did that and it gave me that." in order to zero in on a solution. If anyone were to spend a little time doing some real scientific "process of elimination", you would have already found a solution by now. (Not to mention you seem to be one of only 3 or 4 PAL users on the planet posting in this thread. I wonder why the others don't have your problems?) Anyway, I'm really not getting into this discussion though because I am seriously done with the absurdity of this thread repeating the same crap over and over with no real value.

Matthew
23rd January 2003, 23:40
Originally posted by Mr Zippy
From what I read DVD2AVI looks at the first audio frame and the first video I frame to calculate the AC3 delay, am I to take it that in the case where frames are dropped the AC3 delay is being calcualted from the first video frame that would be frame served, and not the first video frame in the output demux M2V file?

Yes that's right. Smartripper and DVD Decryptor do the same as well. Vobedit doesn't though (it reports the correct delay).

Originally posted by Mr Zippy
This is exactly why I want a fool proof method for 100% audio sync, I don't want to have to play back in my DVD player to discover the sync is wrong. For a example we use the Bitrate viewer before encoding to encsure the field order is encoded the right way round for TV playback. [/B]

I already outlined a full proof method in a previous post in this thread.

TRILIGHT, I could be forgiven for thinking you haven't read this thread. Yes this thread has been rather repetitive and has pretty much outlived its life *but* the observed phenomena are real and it's been revealed as a bug in DVD2AVI.

A solution has been found, as previous posts in this thread show (mpucoder even said we appear to be doing the right thing to correct the problem). The methods have been scientific, in the sense that they have revolved around experiments, but a full understanding of the nature of the DVD format is not reasonably obtained, so it's unfair to critise in that regard.

As for why other people haven't posted in this thread - well 1) the end result is that if you rely on DVD2AVI's audio delay numbers and ensure the delays match up on original and re-authored DVDs by using AC3 delay corrector etc then everything is fine and dandy and 2) people may just do what is in the guides but not notice the desync. I bet there are quite a few PAL users out there with bad sync and they simply don't know it.

A matter of interest (for some people like Mr. Zippy, buy not me) is whether an alternative syncing solution, in the form of using timecodes, can be found.

The only matter of curiousity left for me in this topic is why NTSC is different from PAL in this regard. And that, I might add, has not been adequately explained with scientific method. Not that I particularly mind, it's not my lookout after all ;)

Calypso
24th January 2003, 02:34
if you rely on DVD2AVI's audio delay numbers and ensure the delays match up on original and re-authored DVDs by using AC3 delay corrector etc then everything is fine and dandy

I disagree, from personal experience. I recently re-worked a DVD where DVD2AVI reported -274ms delay for all three audio tracks. As per my usual process, I did nothing to correct this reported delay, and imported the audio directly into Maestro. In preview, it sounded just great. Believe me, you can certainly hear a delay this large.

I then experimented, and used AC3 Delay to 'cut' this delay out of the audio (just as many on this thread insist must be done) and placed it back on the timeline. NOW I had a delay that was obvious. I went back to using the original audio track, with no corrections.

I then ran DVD2AVI on my newly authored VOB, and it now reported a zero second delay. So what is really going on here?

Matthew
24th January 2003, 03:01
Well I had a similar situation, delay was over -200, except the way I achieved correct sync was by cutting frames off. It's quite clearly in sync (as you point out one can tell).

I also remember another case where I ripped a chapter with a large delay, and it was out of sync in Maestro's preview function until I made appropriate adjustments.

Only thing I can think of (apart from human error) is
a) DVD2AVI made a mistake for some reason, not sure why it would though (could use vobedit to test); or
b) Maestro adjusted the streams on the basis of timecodes or whatever, although that doesn't make much sense either. Regardless that could be tested by comparing the number of frames in the video and audio streams that were 1) fed into Maestro and 2) extracted from the reauthored DVD.

And PAL, or NTSC?

Calypso
24th January 2003, 05:49
Originally posted by Matthew
Only thing I can think of (apart from human error) is
a) DVD2AVI made a mistake for some reasonI have always suspected this 'delay' factor. In my case, I have never made any corrections- both when making SVCDs and DVDs.

And PAL, or NTSC?In my case, all NTSC

Matthew
24th January 2003, 06:10
mmmm...well leaving aside the dropped frame issues the delay figures do make sense. If you load a vob in vobedit you can find out the PTS value for the first video frame (say 23 ms) and the PTS value for the first audio frame (say 45 ms). That means there is a difference of 22ms from when the first video frame is displayed and when the first audio frame is displayed.

Not making adjustments with SVCDs doesn't make sense because there's no possibility of timecodes saving your bacon there.

Mr Zippy
28th January 2003, 18:04
I may have a timecode solution to AC3 Sync/delay.

Sonic Scenarist allows you to enter the audio start time.

1) Import your M2V and AC3 in the timeline

2) Click on the audio track in the timeline and select 'audio play' at the bottom of the screen.

3) Look at the audio play properties at the bottom of the screen

If you enter a 'start time' the audio will start at that time.
(not sure if the duration figure is timecode based or the actual lengh of the audio track, so you may need to update that also)

M2V asset - timecode starts ar 00:00:59;05
AC3 asset - no timecode as we have found

If you set the AC3 track 'start time' to 00:00:57;05 then Mux the tracks and playback, the audio is 2 seconds behind !

If DVD2AVI says the delay is -80ms, that is 2 frames before the video starts.

In Scenarist you can then set the audio to start 2 frames before the video.

You would need to check...
1. Possible dropped frames by DVD2AVI - although it has been said here the quoted delay is including any dropped frames when transcoding.
2. The video start timecode cannot be zero or you could not set an earlier audio start time - just set a higher than zero start timecode when transcoing in CCE.

What do you think of this method.

Alphaloop
28th January 2003, 18:09
I may have a timecode solution to AC3 Sync/delay.
Sonic Scenarist allows you to enter the audio start time.


Oh, nice, just invest 1000++ $ to solve a little sync problem. :D

Mr Zippy
28th January 2003, 19:39
It's proabably possible in DVD Maestro, but I don't know how.

Maestro does indicate a box for 'offset' for the AC3 asset - but it's blank and uneditable.

Atleast a workable method in Scenarist is a start.

Lets hope the AC3 delay offset figure in DVD2AVI is accurate, this method is only as accurate as 1 frame or 40ms PAL.

I note that the re-authored video always shows a delay of -80ms in DVD2AVI but you can easily test by setting a -2 second audio offset, which you can easily hear to verify, so it must use something like the AC3 delay corrector and cut frames to match the audio offset specified. Vobedit shows a 0ms delay on the re-authored video.

Matthew
29th January 2003, 02:00
1. Scenarist uses 40ms increments so less accurate than using AC3 delay corrector + Maestro.
2. Scenarist is an annoyance to use when undertaking simple authoring. Subs, chapters import etc are much easier in Maestro.

If you really want to avoid cutting the AC3 you can add a black bitmap at the start of DVDMaestro's timeline (before the video stream). It'll span 15 frames. And then you can drag audio to right accordingly.

e.g. -102 ms delay.

You add your picture. 15 frames = 600 ms

So your delay is now +498 ms. So drag the AC3 by that much to the right.

But really, I'm not sure why you are proceeding with this ;)

Mr Zippy
29th January 2003, 11:05
AC3 Delay corrector does seem to be the best method, as DVDMaestro has a simple user interface.

Is there a way to see if the uncorrected audio is the same sync as the original, I know the PTS values and DVD2AVI delays will not be the same to the frame serving and transcoding. One thing that is odd is DVD2AVI always shows -80ms delays on the re-authroed movie, even when I offset the audio by 2 seconds (-2000ms) which you can easily hear.

Also what keeps the audio in sync through the movie, I have read about poorly masterd DVDs that do not have the AC3 syncing flags - do we need to run create sync audio in DVDMaestro, but then surely we cannot drag forward in the timeline (or can we)

Maybe I am worrying about nothing, I just want to avoid any sync problems before the occur.

Can you tell I'm a worrier ;)

Anyway using AC3 Delay corrector I have had no sync issues yet, and I am looking foward to try commercial software like Pinnacle InstantCopy which if the quality is good will automate the backup process nicely.

Mr Zippy
29th January 2003, 11:09
Matthew, could you please type me you guide to fixing AC3 sync problems using AC3 corrector, including your explanation of how it worked with your examples, so that I may include it on my web site - I will credit yourself and doom9.org.

Then at least other users will be able to find the information easliy if it is required.

Matthew
30th January 2003, 01:57
I think you are worrying about nothing (in regards to audio staying in sync), because the way we are correcting the audio is like what people do with DivX (i.e., no timecodes, just line streams up at the beginning according to initial PTS values). And there are typically no sync problems with DivX.

I'll write a little guide, won't take long :)

Matthew
30th January 2003, 06:19
Well I wrote this, hardly brilliant but I think it suffices ;)


Guide to achieving perfect sync when reauthoring PAL DVDs using DVDMaestro.

Required:
DVDMaestro
AC3 Delay Corrector
DVD2AVI

This guide assumes you have re-encoded the video stream by feeding a DVD2AVI project file to CCE. If you haven't then it isn't valid.

Take the case of a simple DVD that contains one video and one audio stream. These streams are muxed together by an authoring program, and they don't necessarily start at the same time. When they start are governed by the first Presentation Time Stamp (PTS) values included in the muxed vobs (but not the streams themseleves).

Lets call the first video PTS value X and the first audio PTS value Y. The first video frame is played X ms into the DVD and the first audio frame is played back at Y ms into the video stream.

When you re-author in Maestro, it doesn't know about these PTS values as you are just feeding it the video and audio streams. Hence Maestro will mux the DVD such that the first video and audio frames will playback at the same time. This is fine if X = Y, but what if it doesn't? It means that the audio and video will be out of sync.

Here's an example. Lets say the first video PTS is 120 ms and the first audio PTS is 170 ms. This means that the audio stream should start 50 ms later than the video stream (i.e. there is an audio delay of 50 ms). Hence if the streams are muxed without adjustment, the audio will be replayed 50 ms earlier than it should be.

Similarly, in another case lets say the first video PTS is 120 ms and the first audio PTS is 71 ms. This means that the audio stream should start 49 ms earlier than the video stream (i.e. there is an audio delay of -49 ms). Hence if the streams are muxed without adjustment, the audio will be replayed 49 ms later than it should be.

So some adjustment is called for.

The first step is to use DVD2AVI to save your AC3 files along with the DVD2AVI project file. Each AC3 saved will include the delay figure in its filename, e.g. "movie AC3 T01 3_2ch 448Kbps DELAY 50ms.ac3"

If the audio delay is a positive figure, then do the following:

Import assets in Maestro, add them to timeline. Zoom in to the most detailed view (using "+" button).

You want the audio to start later than the video so you drag the audio to the right, the question is by how much. Well 1 video frame = 40 ms, so if your delay is 50 ms then drag to the right by a touch more than 1 frame.

Then compile the project, after a few seconds uncheck the compile box (the result is one main vob of relatively small size, e.g. 60 MB). Open this vob in DVD2AVI and save the project file [and accompanying AC3(s)]. Leave the vob open in DVD2AVI.

If the delay is too large, drag the AC3(s) to the left a fraction, similarly if it is not large enough, drag the AC3(s) to the right. Compile the project for a few seconds and switch back to DVD2AVI (the vob should still be open, no need to re-open it). Again save the AC3(s) using DVD2AVI. Repeat the process until the delay is correct. You should be able to get it within at least 1 ms of the desired figure.

If the audio delay is a negative figure, then it's a little trickier.

You cannot drag the audio to the left of the video in Maestro, so the next best thing is to cut off the start of the audio to remove the delay. However, you can only cut whole frames - which are equivalent to 32 ms - so cut the least number of frames that results in a positive delay. i.e. with a delay of -49 ms

Number of frames to cut = absolute value of delay/32
Number of frames to cut = 49/32
Number of frames to cut = 1.53125

As we can't cut partial frames, round the number up to the nearest whole number, in this case 2. So in AC3 Delay corrector enter in a start-delay of -(2 x 32) = -64 ms, then click write.

New delay = original delay + (number of frames cut x 32)
New delay = -49 + (2 x 32)
New delay = -49 + 64
New delay = 15 ms

Now do exactly what you'd do if you had a positive audio delay (which is outlined above).

---------------------------------------------------


A note on dealing with video streams which have not been re-encoded, or maybe even re-encoded differently (e.g. using REMPEG2)

Some DVDs have an unusual structure at the beginning of the DVD. A bug in DVD2AVI means it ignores the first 2 frames when
1) Calculating the audio delay; and
2) Frameserving to CCE.

The first effect results in a reported audio delay 80 ms less than it should be. But the second effect means the video stream is 2 frames (80 ms) shorter than it should be (the first 2 frames are not in the CCE output).

These 2 effects cancel each other out because in calculating its delay DVD2AVI is ignoring 2 video frames that aren't in the re-encoded video stream anyway.

But what if you are not re-encoding the video stream, or using another program like REMPEG2, which doesn't drop the frames? In this case DVD2AVI is inaccurate, as it is ignoring 2 video frames that are in the video stream you are using.

The easiest solution when using these streams is to use VobEdit instead of DVD2AVI to get the audio delay (you can still use DVD2AVI to extract the audio stream though, just ignore the delay figure). To get the audio delay open the first movie vob and click file, then "Get video/audio delay".

You can still use the guide above, with one exception - whenever you see a reference to using DVD2AVI to obtain the delay value, use vobedit instead.

Mr Zippy
1st February 2003, 00:35
Thanks, I have posted on my site.

http://www.encodinginfo.org.uk/dvd.php#delay

Mr Zippy
4th February 2003, 02:28
Originally posted by Matthew
You want the audio to start later than the video so you drag the audio to the right, the question is by how much. Well 1 video frame = 40 ms, so if your delay is 50 ms then drag to the right by a touch more than 1 frame.

In my tests if you drag the audio 1 frame foward in the timeline the delay shows around 25ms, yet if you drag foward 5 frames it shows 200ms (I'd expect 125ms) therefore I think the timeline is for the video only as audio is 32 frames a second and video is 25.

Also I use VobEdit to test the delay after muxing in DVDMaestro as it saves you actually demuxing anything at all to find on the new delay, as you can click get Video / Audio Delay.

Matthew
4th February 2003, 02:33
Well PAL is 25 frames per second. So that's 25 frames per 1000ms.

1000/25 = 40 ms ;)

As for using VobEdit, I don't think it makes much difference time/effort-wise as the partially muxed vob is small. But alter the guide accordingly if you feel like it :)

Mr Zippy
4th February 2003, 02:37
Thanks for the quick reply, I've just edited my oringal post you replied to whilst you were replying, as I did another quick test.


This is what I changed to...

In my tests if you drag the audio 1 frame foward in the timeline the delay shows around 25ms, yet if you drag foward 5 frames it shows 200ms (I'd expect 125ms) therefore I think the timeline is for the video only as audio is 32 frames a second and video is 25.

Matthew
4th February 2003, 04:32
heh, just tried it and see what you mean, I got 25 ms too.

I think you'll find it's a simple bug in DVDMaestro (i.e. interface is a just little inaccurate). As you can keep dragging to you get the figure you want it don't matter :)

Mr Zippy
6th February 2003, 03:06
One final question.

It has been said, whether frames are dropped or not, just use the same AC3 delay correction method.

Does this mean that on movies where 2 frames are not dropped during frame-serving, that the DVD2AVI delay is reporting correctly for this instance ie. the same as VobEdit would give.

I just re-read the whole topic and could not find this.

---------------------------------------------------

A point of interest............
I just tested a movie that drops 2 frames also with 3 programs:

DVD Decrypter: -88ms delay
DVD2AVI: -72ms delay
Actual delay with VobEdit: 8ms

I note the DVD Decrypter delay is another 16ms different!!!

TRILIGHT
6th February 2003, 03:57
No offense here, guys but it's becoming more and more obvious that this is a conversation between Mr. Zippy and Matthew. I am closing this thread because it is losing it's usefulness. Please discuss methods between the two of you via PM or e-mail. When you feel you've come up with a method others can benefit from, please post it in a new thread with an appropriate topic. This is the only way the information will ever be useful to those trying to find it. Many would not bother reading this thread as it is. Thank you both for your understanding and cooperation.