Fixing the Dragon Box Audio Sync (Maybe)

Discussion regarding the entirety of the franchise in a general (meta) sense, including such aspects as: production, trends, merchandise, fan culture, and more.
User avatar
ect5150
Advanced Regular
Posts: 1063
Joined: Fri Sep 15, 2006 9:17 pm
Location: Tenkaichi Tournament Grounds

Fixing the Dragon Box Audio Sync (Maybe)

Post by ect5150 » Thu May 22, 2014 10:12 pm

The story---

We have a lot of great threads here to help those that enjoy using our DVDs as we would like to use them. Fixing the DBox colors has been popular lately. While I was encoding a particular episode, I ran across a very nasty snag - the audio was way out of sync for this particular episode ("DB 138 - Shen, Man of Mystery"). Others on the forums have pointed out a lot of the action often takes place around 0.2 seconds out of sync with the audio. For some of us, it's only a small difference. But this was closer to an entire second and it was very noticeable. The odd thing was I had encoded this episode in the past and was sure I never noticed an audio gap this large. As luck would have it, I still had the old video file on a secondary hard drive. Opened it up in MPC-HC, and alas... no audio problem.

"What gives?" I thought... "What was different?"

The answer came in two pieces. 1) I was re-encoding the episodes and adjusting the colors. That wouldn't affect the audio, but the other difference was 2) I was including the opening, credits and next episode preview. With my old video file, I left those out... I didn't want to commit harddrive space to the same old song and just started at the recap portion of the video. The second time around I reversed that decision.

This kicked off a small investigation. Normally, when we rip a DVD, we grab the entire episode (as seen below)--

Image

The above image is of a R2 Dragon Box single DVD. I have the 5th Program Chain selected with all chapters selected. This is actually the 3rd episode on that particular disc. Ripping all of those chapters into a single VOB grabs the entire episode. Apparently, and what I believe, is that all of episodes in the Dragon Box are actually multiple videos within the same Video Tile Set (VTS_01_1.VOB). This can create a problem.

The problem---
Normally when we rip a movie or anime, we rip the VOB file and extract the audio. Many times the audio doesn't start at the same time index as the video. When this happens, the audio needs a time adjustment. You might delay the start of the audio by 200 milliseconds. A lot of the programs out there use the practice of just making the audio offset apart of the audio file name, as seen below.

Image

The issue is that some discs out there have multiple videos in each tile set. And each video can require its own audio offset. It appears to me that DBox episodes are created in this fashion. One episode is essentially split up into 4 or 5 sections. 1) The intro, 2) the first half of the episode up to the eyecatch, 3) the second half of the eyecatch to the credits, 4) the credits them-self and 5) the next episode preview. Each of these sections of the video has the potential to require it's own audio offset. This is the key!

The solution---

To the best of my observations, these "sub-videos" are at least divided up around the chapter points within the video. This means, as the audio is concerned, each chapter must be ripped individually. In the below picture, I've only selected the 3rd chapter--

Image

All of the episodes on the R2 release are split into 6 chapters. I can correct the audio offset for all of the episodes (so far that I have tested this with) by ripping each chapter into it's own directory and using the following script in AVISynth:

Code: Select all

LoadPlugin("C:\Video\Programs\megui\tools\dgindex\DGDecode.dll")
LoadPlugin("C:\Video\Programs\megui\tools\avisynth_plugin\ColorMatrix.dll")

V1 = DGDecode_mpeg2source(".\1\VTS_01_1.d2v", info=3).tfm(d2v=".\1\VTS_01_1.d2v",slow=2,PP=0,mode=5).tdecimate(mode=1,hybrid=1)
V2 = DGDecode_mpeg2source(".\2\VTS_01_1.d2v", info=3).tfm(d2v=".\2\VTS_01_1.d2v",slow=2,PP=0,mode=5).tdecimate(mode=1,hybrid=1)
V3 = DGDecode_mpeg2source(".\3\VTS_01_1.d2v", info=3).tfm(d2v=".\3\VTS_01_1.d2v",slow=2,PP=0,mode=5).tdecimate(mode=1,hybrid=1)
V4 = DGDecode_mpeg2source(".\4\VTS_01_1.d2v", info=3).tfm(d2v=".\4\VTS_01_1.d2v",slow=2,PP=0,mode=5).tdecimate(mode=1,hybrid=1)
V5 = DGDecode_mpeg2source(".\5\VTS_01_1.d2v", info=3).tfm(d2v=".\5\VTS_01_1.d2v",slow=2,PP=0,mode=5).tdecimate(mode=1,hybrid=1)
V6 = DGDecode_mpeg2source(".\6\VTS_01_1.d2v", info=3).tfm(d2v=".\6\VTS_01_1.d2v",slow=2,PP=0,mode=5).tdecimate(mode=1,hybrid=1)

A1 = DirectShowSource(".\1\VTS_01_1 T80 2_0ch 448Kbps DELAY 0ms.ac3").DelayAudio(-0.0)
A2 = DirectShowSource(".\2\VTS_01_1 T80 2_0ch 448Kbps DELAY -659ms.ac3").DelayAudio(-0.659)
A3 = DirectShowSource(".\3\VTS_01_1 T80 2_0ch 448Kbps DELAY -224ms.ac3").DelayAudio(-0.224)
A4 = DirectShowSource(".\4\VTS_01_1 T80 2_0ch 448Kbps DELAY -232ms.ac3").DelayAudio(-0.232)
A5 = DirectShowSource(".\5\VTS_01_1 T80 2_0ch 448Kbps DELAY -273ms.ac3").DelayAudio(-0.273)
A6 = DirectShowSource(".\6\VTS_01_1 T80 2_0ch 448Kbps DELAY -397ms.ac3").DelayAudio(-0.397)

AV1 = AudioDub(V1,A1)
AV2 = AudioDub(V2,A2)
AV3 = AudioDub(V3,A3)
AV4 = AudioDub(V4,A4)
AV5 = AudioDub(V5,A5)
AV6 = AudioDub(V6,A6)

video = AV1 ++ AV2 ++ AV3 ++ AV5 ++ AV6 ++ AV4
return video
If we look at the script, we can see the problem. Extracting a single audio file, from beginning to end, did not require any audio offset (as seen my my "A1" audio line). No program reported any need to offset the audio as the opening song didn't need it. But look at the first part of the episode (labeled "A2")-- the audio needs an offset of 659 milliseconds. Almost 0.7 seconds out of sync from the video. This was the difference I had seen before. Continuing with each chapter, most of the other chapters only need about 200 milliseconds adjustment. Each episode in the series has varying degrees of audio offsets for each sub-video. I will also point out that doing this allows me to switch the order of the episodes and place the credits after the next episode preview, like they are "meant" to be. This also explains why my old video didn't appear to be out of sync. Since I skipped the intro, my software would have reported an offset of 659ms and I would have adjusted it accordingly (however, the other portions of my old video were still slightly off).

As further evidence, I offer a small video of that same episode here. The first half of the video is ripping the video straight (all chapters at once - labeled "Unadjusted Audio"). The second half is ripping it chapter by chapter (labeled "Adjusted Audio").

I should note that not all encoding techniques/program are subject to this issue. This really just targets people that extract the audio file and encode it directly. I see many DVD ripping guides out there advocate this, so I assume I can't be the only one. After all, this problem doesn't exist when ripping movies (they don't break it up into "sub-movies" unless you count the FBI warning or things like that... but those don't have audio, etc...). Also, I've noticed some programs like Handbrake that deal directly with the VOB for everything may not have this problem, it apparently looks for the audio offsets and deals with things correctly.

I would love it if some of you who encode your own videos would try this our and report your results and see if you can tell a difference. My eyes and ears don't seem to be as sharp as the forum as a whole :D I welcome feedback... does this help (it seem to help a great deal to me)?? or am I full of sh**?? or all of the above?? or what??
ect5150
Better to keep your mouth shut and appear stupid than to open it and remove all doubt.
DB DBox color corrections & DBox color corrections.