Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] video and audio out of sync
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2712
Location: Edmonton, AB

PostPosted: Wed May 14, 2008 11:29 pm    Post subject: [SOLVED] video and audio out of sync Reply with quote

After multiplexing audio and video:
Code:
mplex -f 8 -o final.mpg movie.m2v movie.ac3
the audio is out of sync with video.

Searching through the forums I've run onto this post
https://forums.gentoo.org/viewtopic-t-221411-highlight-mpeg2desc.html (last entry)
that suggest that:
Quote:
offsets can be obtained by using mpeg2desc (comes with dvdauthor):
Code:
$ mpeg2desc < stream.vob | grep pts | head
The audio offset is the difference between the first video pts, and audio pts. Pass this to mplex with -O and it works


Running this code I get:
Code:
mpeg2desc < final.mpg | grep pts | head
0000080e: pes video 0; length=2028; hdr=16; pts 0.178 sec; dts 0.144 sec; (pext); pstd=237568 (scale=1024)
0000200e: pes private1, audio 0; length=2028; hdr=11; pts 0.178 sec; (pext); pstd=16384 (scale=1024)
0000280e: pes private1, audio 0; length=2028; hdr=8; pts 0.274 sec
0000380e: pes private1, audio 0; length=2028; hdr=8; pts 0.338 sec
0000400e: pes private1, audio 0; length=2028; hdr=8; pts 0.402 sec
0000480e: pes private1, audio 0; length=2028; hdr=8; pts 0.466 sec
0000580e: pes private1, audio 0; length=2028; hdr=8; pts 0.562 sec
0000600e: pes private1, audio 0; length=2028; hdr=8; pts 0.626 sec
0000680e: pes private1, audio 0; length=2028; hdr=8; pts 0.690 sec
0000800e: pes video 0; length=2028; hdr=13; pts 0.778 sec; dts 0.745 sec

I'm not exactly sure which parameters to read. The first line "video 0; ... pts 0.178 sec"
second line "audio 0; ... pts 0.178 sec"
The "pts" are the same value; or am I reading the wrong line?


Last edited by Joseph_sys on Thu May 15, 2008 6:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
yabbadabbadont
Advocate
Advocate


Joined: 14 Mar 2003
Posts: 4791
Location: 2 exits past crazy

PostPosted: Thu May 15, 2008 12:18 am    Post subject: Reply with quote

When playing the file with mplayer, you can adjust the audio delay using the + and - keys. Each key-press will adjust the delay by +/- 0.1 seconds.

I've used this in the past to determine the correct adjustment to use when re-mplexing the files.
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2712
Location: Edmonton, AB

PostPosted: Thu May 15, 2008 12:48 am    Post subject: Reply with quote

I'm not sure if I need to go down or up :-/
There is another switch "-m" so it should be:
Code:
mpeg2desc -m < final.mpg
it should give me a number but I'm getting:
Code:
mpeg2desc -m < final.mpg
Could not read
Back to top
View user's profile Send private message
yabbadabbadont
Advocate
Advocate


Joined: 14 Mar 2003
Posts: 4791
Location: 2 exits past crazy

PostPosted: Thu May 15, 2008 1:10 am    Post subject: Reply with quote

You just have to play with the + and - keys in mplayer until you get it to match up. If I remember correctly, it shows the current offset on screen each time you hit one of the keys.
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2712
Location: Edmonton, AB

PostPosted: Thu May 15, 2008 6:40 pm    Post subject: Reply with quote

yabbadabbadont wrote:
You just have to play with the + and - keys in mplayer until you get it to match up. If I remember correctly, it shows the current offset on screen each time you hit one of the keys.


I think I solve it by adding "-M1" switch to transcode line.
Quote:
Sync modes
-M mode [1]
demuxer PES AV sync mode (0=off|1=PTS only|2=full)

It multiplexed correctly.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum