Log in

View Full Version : find audio offset of mpeg2 file


phelix
18th October 2003, 06:29
Is there a tool that will tell me what the audio offset of a mpeg2 file? I know I can use VobEdit to find the offset for VOBs, but I need the offset of a normal mpeg2 file.

In case it matters, the mpeg2 files are rips from a PVR drive.

oddyseus
18th October 2003, 13:48
run it through dvd2avi and choose demux all streams. U will notice the offset in its name.

phelix
18th October 2003, 18:30
Thanks, but dv2avi doesn't report the correct audio delay. I tried a test where I muxed a file (using mplex ) with an offset of -2 ms. dv2avi reported the offset as -98ms.

oddyseus
19th October 2003, 07:51
delays up to 80ms, ie 2 frames, r hardly noticable even on leap sync. I doubt that there is a person that can notice even a 3 frame (120ms) error in sync. I certainly don't.

smiller667
19th October 2003, 10:21
Out of curiosity, I did a few experiments, muxing mpeg2 video (svcd) with mp2 audio.
mux offset offset reported by dvd2avi
-100 -100
-150 -45
-170 -65
-200 -200Seems it sometimes is way off.

killingspree
19th October 2003, 11:29
hmm... now that is definitely strange. i'm gonna write a PM to Nic to see if he's aware of these differences or if he's got an explanation for them!

steVe

Nic
19th October 2003, 13:28
http://nic.dnsalias.com/ReJig.zip

download that and load the MPEG in and see what it reports as the delay (just out my own personal curisoity ;) )

Also cut the first 1-3mb out of the file and post it somewhere if you can.

I very much doubt dvd2avi is wrong, mplex may be inaccurate when muxing. Because, you can calculate delay from the first audio PTS minus the first video PTS (or vice versa). But that is not always correct, because the first video PTS may not be that of an I frame (or the first in the temporal order).

(long story short: mplex may be offseting the first two PTS' by -2ms, but that doesn't mean the first video frame won't be at -98ms)

That's my guess, with 1-3mb of the file, I could say accurately just by browsing the frame types and PTS info.

-Nic

ps
Although it could be a completely different incident, this thread may develop an answer:
http://forum.doom9.org/showthread.php?s=&threadid=63467

phelix
20th October 2003, 00:50
Hee's my lastest test. Muxed with mplex using the following commandline:

mplex -f 8 -O -150 -o sample.mpg sample.m2v sample.mp2

offset should be -150. Here's what I get


dv2avidg 116
dv2avi (1.76) 49
rejig 50
vobedit (after authoring) 150


Does vobedit normally invert the sign like that?

phelix
20th October 2003, 03:32
forget about my last post. The sample file was corrupt. Here are some new results:

I ran mplex twice to produce a file with a +150 or -150 offset, a third sample from a different file, and a forth sample with no offset.


(sample1)
mplex -150
dvd2avi 116
vobedit 116

(sample2)
mplex +150
dvd2avi -183
vobedit -183

(sample3)
mplex -11
dvd2avi -22
vobedit 11

(sample4)
mplex 0
dvd2avi -33
vobedit 0


(note: vobedit was run on the VOB, after authoring with svcd2dvd)

The sample files are at:

sample1 (-150) (http://personal.vallnet.com/~phelix/sample1_mplex_minus_150.mpg)

sample2 (+150) (http://personal.vallnet.com/~phelix/sample2_mplex_plus_150.mpg)


sample3 (-11) (http://personal.vallnet.com/~phelix/sample3_mplex_minus_11.mpg)

sample4 (0) (http://personal.vallnet.com/~phelix/sample4_mplex.mpg)

At this point, I don't know what to think. Samples 1 and 2 suggest mplex is at fault. However, the other samples suggest dvd2avi is wrong. Ugh. :confused: :mad: :confused:

phelix
22nd October 2003, 21:43
I found another program that reports audio offsets, pvastrumento. I've also used bbinfo to find the timestamps of the audio and video streams. Here's the results for the four samples in my previous post:


sample 1 2 3 4
mplex offset -150 150 -11 0

video dts 144.655556 294.655556 144.655556 144.655556
video pts 178.022222 328.022222 244.755556 244.755556
audio pts 294.655556 144.655556 155.655556 144.655556
audio_offset 116.633334 -183.366666 -89.1 -100.1


dvd2avi 116 -183 -22 -33
pvastrumento 116 -183 -89 -100
vobedit 116 -183 11 0


I hope I'm calculating this right. Audio_offset is just the audio PTS - VIdeo PTS. Anyway, it certainly looks like dvd2avi is wrong for samples 3 and 4.