Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd February 2009, 20:12   #1  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Source MPEG PS plays fine, demuxed result goes out of sync.

Hi folks,

I have a couple of sources that are giving me a hard time.

The sources are MPEG Program Streams, with MPEG-2 video, and Dolby Digital audio. They play fine in Media Player Classic and VLC, with no sync issues whatsoever.

However, when I try to demux the audio track, I get something that goes out of sync after a certain point. DGIndex and eac3to are my standard tools, but both produce the same result. I even tried transcoding the audio from the source using Avisynth and DirectShow + SoundOut, and got the same result!

I tried cutting a piece of this program stream using MPEG2Cut2, but this also goes out of sync!

Am I going insane? Any suggestions are welcome!!

Thanks in advance,
~MiSfit
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 2nd February 2009 at 20:16.
Blue_MiSfit is offline   Reply With Quote
Old 2nd February 2009, 20:16   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Are they live captures with commercials? Sometimes the audio parameters change at commercials.
Guest is offline   Reply With Quote
Old 2nd February 2009, 20:25   #3  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Hi neuron2,

No, these are 50mbps CBR captures from some sort of HD tape (comes from one of our partner encoding houses).

~MiSfit
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 2nd February 2009 at 20:59.
Blue_MiSfit is offline   Reply With Quote
Old 2nd February 2009, 20:48   #4  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Post a sample that includes a point at which sync changes.
Guest is offline   Reply With Quote
Old 2nd February 2009, 20:58   #5  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Okay, uploading now. It's big... 320MB. Sorry about that, the point where it seems to go out of sync doesn't have much in the way of audio, so I included a large range to be safe. I'll update this post when it's completed.

http://www.megaupload.com/?d=XBCIHON0

Thanks!!

~MiSfit
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 2nd February 2009 at 21:30.
Blue_MiSfit is offline   Reply With Quote
Old 2nd February 2009, 22:36   #6  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
You say you demux the audio. But what do you do with the video? Do you remux the audio to some other container? Along with the video? Or do you play the video inside of the original MPEG container while playing the audio externally? I'm asking because this could be a problem related to the source filters you're using for playback...
madshi is offline   Reply With Quote
Old 2nd February 2009, 23:58   #7  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Madshi:

I've done it one of a few ways. The standard procedure is to process audio directly to a new AC3, then encode video (to H.264), then mux to a TS, which then goes through QA. This is where the problem was detected.

To diagnose the problem, I've completely demuxed the program stream, and remuxed with the original MPEG-2 video. I've also used the little trick in Media Player Classic where it loads audio tracks based on file names.

So for example, if meat.m2v and meat.ac3 are in the same directory, opening meat.m2v will also play audio from meat.ac3.

~MiSfit
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 3rd February 2009, 02:07   #8  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Regarding your sample...

The video has jerks in it. Are you aware of that?

I don't see a sync discontinuity. To get the screeching of the train's stop at the beginning and the talking at the end in sync, I apply:

vid=MPEG2Source("MidnightMeatTrain_178_6ch_2008.d2v")
aud=nicac3source("MidnightMeatTrain_178_6ch_2008 T80 3_2ch 640Kbps DELAY 50ms.ac3",2).DelayAudio(-.700)
audiodub(vid,aud)

So I don't think the sync changes in the clip. But it does mismatch the delay declared by DGIndex. I'll have to study that in more detail.

Have you a sample where there is a discernible sync discontinuity? If not, then you can solve this with an appropriate audio offset.
Guest is offline   Reply With Quote
Old 3rd February 2009, 02:47   #9  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
neuron2,

Thanks for looking!

When you say "jerks", what exactly do you mean?

I'm uploading another (larger) sample that should be helpful, and seems to contain the sync change. When played normally this sample will be in sync.

When demuxed to M2V+AC3 with DGIndex, and played back, it will be out of sync by the end. The opening fight scene will be in sync, but the ending piece of dialogue - "please" will be clearly out of sync.

Apologies ahead of time for the excessive gore It's Lionsgate...

I'll make another post when I get in tomorrow morning and the sample is finished uploading.

Thanks for your time!

~MiSfit
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 3rd February 2009 at 03:07.
Blue_MiSfit is offline   Reply With Quote
Old 3rd February 2009, 03:05   #10  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
I mean there are visible jerks. Single step and you can see missing frames -- discontinuous motion.

I like gore. Even if he was wrong about global warming. Bring it on.
Guest is offline   Reply With Quote
Old 3rd February 2009, 03:48   #11  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988


Interesting find! I think it might be part of production... this whole scene is pretty disconcerting, what with the flickering lights and fast action.

~MiSfit
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 3rd February 2009, 04:01   #12  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Waiting for your new upload...watching Family Guy while I wait.
Guest is offline   Reply With Quote
Old 3rd February 2009, 05:22   #13  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
I hope you have lots of episodes stocked up, because it's going to be tomorrow morning

Thanks again for your kind help!

~MiSfit
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 3rd February 2009, 09:39   #14  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
neuron2 is quite right with saying that video frames are missing. Here's the eac3to log when remuxing to MKV:

Code:
eac3to v3.06
command line: eac3to MidnightMeatTrain_178_6ch_2008.MPG test.mkv
------------------------------------------------------------------------------
MPG, 1 video track, 1 audio track
1: MPEG2, 1080p24 /1.001 (16:9)
2: AC3, 5.1 channels, 640kbps, 48khz, dialnorm: -27dB, 51ms
[v01] Extracting video track number 1...
[v01] Muxing video to Matroska...
[a02] Extracting audio track number 2...
[a02] Removing AC3 dialog normalization...
[a02] Applying (E-)AC3 delay...
[a02] A remaining delay of -13ms could not be fixed.
[a02] Creating file "test - 2 - AC3, 5.1 channels, 640kbps, 48khz.ac3"...
[v01] Video has a gap of 2 frames at playtime 0:00:18.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:18.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:19.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:19.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:19.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:19.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:20.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:20.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:20.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:20.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:20.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:21.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:22.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:24.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:27.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:30.  <WARNING>
[v01] Video has a gap of 2 frames at playtime 0:00:31.  <WARNING>
[v01] The MKV file was created without making use of the gap/overlap information.  <WARNING>
[v01] Please check whether audio is in sync. If it is in sync everything is fine.  <WARNING>
[v01] Otherwise ask eac3to to repeat the muxing. It will then automatically make  <WARNING>
[v01] use of the detailed gap/overlap information.  <WARNING>
Added fps value to MKV header.
Video track 1 contains 1272 frames.
eac3to processing took 9 seconds.
Done.
When I play the resulting MKV + AC3 file, audio gets clearly out of sync. However, if I let eac3to redo the MKV file timestamps to honor the gaps in the video stream, video and audio are in sync again when playing the MKV + AC3 combination.

So the problem is that the video stream is missing frames. If you simply demux the video, these missing frames mean that the video is too short compared to the audio. When playing the video in its original container, although some frames are missing, the timestamps in the container take care of that audio and video stay in sync. By demuxing the video track you're losing the timestamp information.

Make sure you get a proper stream from your encoding house and the problem should disappear automatically...

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

P.S: Damn, I should have waited with posting this, because now we might not get that bigger upload. Let me retract my statement. Hmmmmm... I think in order to analyze this problem, you need to upload the whole movie for us to look at...
madshi is offline   Reply With Quote
Old 3rd February 2009, 14:48   #15  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Yes, madshi sounds spot on. But if Blue remuxed it, those timestamp discontinuities shouldn't be there (muxer rewrites timestamps) unless his muxer hosed up. Blue, what muxer did you use? Can you give us a cut of the original, unprocessed source, so we can see if the problem is in the source or you introduced it with your process.

Last edited by Guest; 3rd February 2009 at 14:53.
Guest is offline   Reply With Quote
Old 3rd February 2009, 14:57   #16  |  Link
madshi
Registered Developer
 
Join Date: Sep 2006
Posts: 9,140
As far as I understand the MPEG fragment we got is the original container coming from the encoding house?
madshi is offline   Reply With Quote
Old 3rd February 2009, 14:59   #17  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
If so, then case closed. I understood it the other way, but we'll soon find out.

"To diagnose the problem, I've completely demuxed the program stream, and remuxed with the original MPEG-2 video."
Guest is offline   Reply With Quote
Old 3rd February 2009, 20:59   #18  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Hi all,

Yes, both fragments I posted were from the original, albeit cut with MPEG2Cut2, which I'm no expert in. I know it can alter streams quite a bit.

Here's the latest sample I uploaded last night:
http://www.megaupload.com/?d=KFRIRGUW

madshi, I'm still groking your findings.

So, you're saying that because there are missing video frames, the demuxed (or re-encoded) video will go out of sync after the point where the missing frames should have been, because this mux doesn't have the timestamps (pts, right?).

Quote:
Hmmmmm... I think in order to analyze this problem, you need to upload the whole movie for us to look at...
I'd be happy to provide it... but unfortunately our licensing agreement with the studio doesn't allow me to do this I'm sorry...

neuron2:
Quote:
If so, then case closed. I understood it the other way, but we'll soon find out.

"To diagnose the problem, I've completely demuxed the program stream, and remuxed with the original MPEG-2 video."
Right. I demuxed the program stream and remuxed it to a TS using TSMuxeR, and got a file that goes out of sync at the same place. This was just a sanity check to make sure nothing in my encoding chain was throwing a wrench into things.

I know it's an ugly workaround, but is there any way to extract these timestamps from the program stream, and include them in the mux of a transport stream containing H.264 and re-encoded AC3? Our in-house muxer has support for something like this.

The real question now becomes how 3 files on the same disk were corrupted like this. I've already ordered redeliveries, but WTH?

Thanks again for your help, gents!

~MiSfit
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 3rd February 2009 at 21:04.
Blue_MiSfit is offline   Reply With Quote
Old 3rd February 2009, 21:41   #19  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Don't use MPEG2CUT!!!!!

Use DGSplit to get an unaltered cut. Then upload that. It's not worth bothering with anything other than the original untouched stream. Really.
Guest is offline   Reply With Quote
Old 3rd February 2009, 22:12   #20  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
Ouch. I had no idea MPEG2Cut2 was such a bad idea

I'll do another upload with DGSplit.

Here's my guess on how to do it:

Cut ~900MB starting at ~81.1% of the total filesize - 81.1% being roughly where I started the previous sample with MPEG2Cut2 based on timecode, and hope for the best?

Sorry, I'm new to this app.

~MiSfit
__________________
These are all my personal statements, not those of my employer :)

Last edited by Blue_MiSfit; 3rd February 2009 at 22:15.
Blue_MiSfit is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Forum Jump


All times are GMT +1. The time now is 13:33.


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