[MPlayer-users] Audio sync problem with mencoder

183 views
Skip to first unread message

Greg Ward

unread,
Mar 11, 2012, 8:42:31 PM3/11/12
to mplaye...@mplayerhq.hu
Hi all --

I've been a happy user of mencoder for many years, mainly for ripping
DVDs. Something changed recently and it stopped working: specifically,
the audio is no longer in sync with video. I first started having this
problem with Ubuntu's binary package a couple of weeks ago; it's still
happening with the current binary from Ubuntu 11.10 (version
1.0~rc4.dfsg1+svn33713-1). I just built mplayer/mencoder from source
(svn r34809) and the problem is still there.

The symptom is simple: the audio is about 30 sec behind the video, at
least near the start of the file. (I have not tried to determine if
it's a simple fixed offset, or if the delay changes later in the
file.)

Everything works perfectly when I play the DVD using either mplayer or
VLC.

Comparing DVD playback to playing from the ripped file, it appears
that the audio plays at the same speed, but the video goes too fast.
Example: I've just ripped the first 3 min of a DVD where the first
dialog is at 2:29 when playing the DVD. In the ripped file, the
character's mouth moves at 1:59, but the words don't come until 2:29.

I get the same problem when I play the ripped file with either mplayer
or VLC, so I assume the problem is in the file rather than the player.

Here's the command I use to rip:

mencoder dvd://1 -quiet \
-oac copy \
-ovc lavc \
-lavcopts vcodec=mpeg4:vhq:vbitrate=2048:autoaspect=1 \
-mc 0 -noskip \
-o <outfile>

("-mc 0 -noskip" is a recent addition after I Google'd for mencoder
audio sync problems. It does not seem to have helped.)

Oh yeah, I'm doing one-pass ripping -- I've never bothered to figure
out two-pass, since I'm not hugely concerned about disk space or
quality. I just keep my rips until I get around to watching the movie
and then delete them.

I usually rip to .avi files. I've tried different container formats
(.mkv, .mpg), and still have similar problems.

Any suggestions?

Oh yeah, system info:
* Ubuntu 11.10 (oneiric)
* uname -a: Linux lucifer 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
* libc version:
$ ls -l /lib/*/libc[.-]*
-rwxr-xr-x 1 root root 1685816 2012-03-06 21:17 /lib/x86_64-linux-gnu/libc-2.13.so
lrwxrwxrwx 1 root root 12 2012-03-06 21:17 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.13.so
* gcc, ld, binutils:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.1-9ubuntu3'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin
--enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.21.53.20110810
$ as --version
GNU assembler (GNU Binutils for Ubuntu) 2.21.53.20110810
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.

Thanks!

Greg
_______________________________________________
MPlayer-users mailing list
MPlaye...@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users

Oliver Seitz

unread,
Mar 12, 2012, 2:33:34 AM3/12/12
to mplaye...@mplayerhq.hu

> since I'm not hugely concerned about disk space or
> quality.

If disk space is no problem, why transcode at all?

mplayer dvdnav://1 -dumpstream -dumpfile <filename.vob>

Greets,
Kiste

Zacharias

unread,
Mar 12, 2012, 8:57:39 AM3/12/12
to mplaye...@mplayerhq.hu, gr...@gerg.ca
im not that experienced. i ve jsut recentlymove to linux as my main OS. but
acttualy i have the same issue.
i thought it would be something wrong with my config. i actually do dump
fisrtly the video woth no sound to m2v format, (i thnk. im not at home atm
so i cant confirm) but i think youll get the point.
but when i mux the video and the audio in an mkv container, i get the
delay. its very weird.
any thoughts?

----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 11 Mar 2012 20:42:31 -0400
> From: Greg Ward <gr...@gerg.ca>
> To: mplaye...@mplayerhq.hu
> Subject: [MPlayer-users] Audio sync problem with mencoder
> Message-ID: <2012031200...@gerg.ca>
> Content-Type: text/plain; charset=us-ascii

Alexander Roalter

unread,
Mar 12, 2012, 10:36:13 AM3/12/12
to MPlayer usage questions, feature requests, bug reports
Am 12.03.2012 13:57, schrieb Zacharias:
> im not that experienced. i ve jsut recentlymove to linux as my main OS. but
> acttualy i have the same issue.
> i thought it would be something wrong with my config. i actually do dump
> fisrtly the video woth no sound to m2v format, (i thnk. im not at home atm
> so i cant confirm) but i think youll get the point.
> but when i mux the video and the audio in an mkv container, i get the
> delay. its very weird.
> any thoughts?
>

I'm no expert on this, but IIRC, the original video stream can contain
additional sync information that gets lost if they are extracted
separately and later muxed together. I don't know if that's the case in
your situation, though

--
cheers,
Alex

Erik Auerswald

unread,
Mar 12, 2012, 1:33:19 PM3/12/12
to mplaye...@mplayerhq.hu
Hi,

On Sun, Mar 11, 2012 at 08:42:31PM -0400, Greg Ward wrote:
> ... since I'm not hugely concerned about disk space or


> quality. I just keep my rips until I get around to watching the movie
> and then delete them.

You could use 'cat /dev/dvd > dvd.image' and 'mplayer -dvd-device dvd.image
dvd://' instead.

Erik

Greg Ward

unread,
Mar 12, 2012, 9:28:58 PM3/12/12
to MPlayer usage questions, feature requests, bug reports
On 12 March 2012, Oliver Seitz said:
> > since I'm not hugely concerned about disk space or
> >quality.
>
> If disk space is no problem, why transcode at all?
>
> mplayer dvdnav://1 -dumpstream -dumpfile <filename.vob>

Hey, good idea. It even works too!

However, based on another reply, it sounds like I'm not the only one
seeing this sync problem. Could be a recently introduced bug that
affects transcoding but not -dumpstream.

Also, my home network is a mere 100 Mbits. When copying files from the
PC to the living room, 1.5 GB is nicer than 6 GB. So space is a bit of
a concern. I'd like to be able to transcode.

[Erik Auerswald suggested]


> You could use 'cat /dev/dvd > dvd.image' and 'mplayer -dvd-device dvd.image
> dvd://' instead.

Yeah, I knew about that ... the trouble with that is, it preserves the
DVD menus and "special features" and annoying previews and silly
things that I'm not interested in watching. When I rent a movie, I
want to watch *the movie*, not 5 minutes of extraneous crud.

(Memo to Hollywood: I'm perfectly happy to pay for movies, but when I
pay for a movie and you shove extraneous crud down my eyeballs as the
cost of watching a legit DVD, it makes me wonder...)

Thanks!

Greg
--
Greg Ward http://www.gerg.ca/
War is Peace; Freedom is Slavery; Ignorance is Knowledge

Zacharias

unread,
Mar 13, 2012, 8:38:59 AM3/13/12
to mplaye...@mplayerhq.hu, gr...@gerg.ca, al...@roalter.it
Ciao alex! :)
well i do it so because one weird thing happened:
i did dumped the .vob file through the command : mplayer dvd://1
-dumpstream -dumpfile movie.vob and then encoded/did the rip from the
.vobfile, but! there's a big issue here:
i realised afterwards that the audio was not synched and another thing
happened: the subtitles were burnt in the final coded videofile.avc or mkv
for some weird reason.

that's why i dump the video only and then the AC3 audio.
any thoughts? with the synch and this subtitle thing
regards,
zach


> Message: 3
> Date: Mon, 12 Mar 2012 15:36:13 +0100
> From: Alexander Roalter <al...@roalter.it>
> To: "MPlayer usage questions, feature requests, bug reports"
> <mplaye...@mplayerhq.hu>
> Subject: Re: [MPlayer-users] Audio sync problem with mencoder
> Message-ID: <4F5E09DD...@roalter.it>
> Content-Type: text/plain; charset=UTF-8; format=flowed


>
> Am 12.03.2012 13:57, schrieb Zacharias:
> > im not that experienced. i ve jsut recentlymove to linux as my main OS.
> but
> > acttualy i have the same issue.
> > i thought it would be something wrong with my config. i actually do dump
> > fisrtly the video woth no sound to m2v format, (i thnk. im not at home
> atm
> > so i cant confirm) but i think youll get the point.
> > but when i mux the video and the audio in an mkv container, i get the
> > delay. its very weird.
> > any thoughts?
> >
>
> I'm no expert on this, but IIRC, the original video stream can contain
> additional sync information that gets lost if they are extracted
> separately and later muxed together. I don't know if that's the case in
> your situation, though
>
> --
> cheers,
> Alex
>
>

Nico Sabbi

unread,
Mar 13, 2012, 10:49:00 AM3/13/12
to MPlayer usage questions, feature requests, bug reports
Greg Ward ha scritto:

> [Erik Auerswald suggested]
>> You could use 'cat /dev/dvd> dvd.image' and 'mplayer -dvd-device dvd.image
>> dvd://' instead.
> Yeah, I knew about that ... the trouble with that is, it preserves the
> DVD menus and "special features" and annoying previews and silly
> things that I'm not interested in watching. When I rent a movie, I
> want to watch *the movie*, not 5 minutes of extraneous crud.
>
>
then add the title number to dvd:// and the extra content won't be dumped.

Mike Castle

unread,
Mar 13, 2012, 12:22:46 PM3/13/12
to MPlayer usage questions, feature requests, bug reports
I started a recent thread over on mencoder-users about mencoder and
AC3 sync issues.
http://lists.mplayerhq.hu/pipermail/mencoder-users/2012-March/013075.html

I've narrowed down problem to a set of changes: works before a certain
point in time, fails afterwards. At least for my system.

The exact change where it fails doesn't make much sense to me, so I
really think it's two changes in combination (basically a reworking of
how time stamps are tracked).

I won't have time to delve into it much more for a while. Maybe a dev
with more familiarity with the code could look at it?

If you decide to try to use a version from the point in time that I
describe in that thread, don't forget that you will also need to do a
git checkout for ffmpeg from that point in time, which means doing a
full git clone. This will take more time than the --rebase --ff-only
method that mplayer's configure script will do by default. And then
doing a [git checkout ......] to a change from the appropriate era
(current ffmpeg is incompatible with the version of mencoder source
from the time that it works for me). I wasn't too precise with the
version of ffmpeg that I used. Just something random from the day in
question (2011-02-22). But the mplayer change was important.

mrc

Zacharias

unread,
Mar 14, 2012, 8:17:18 AM3/14/12
to mplaye...@mplayerhq.hu, gr...@gerg.ca, al...@roalter.it
So yesterday i decided to encode a new dvd backup.
so i started to dump only the video to an .m2v file. and then i dumped the
audio i wanted from the the dvd.
i've been searching on the web what could cause the audio lag on the
encoded and muxed file, and i found an old thread on doom9 that stated the
probably the problem relied on the* -hardup *on the script. so i risked it
and remove the parameter from my script.
truth be told: i got no audio problem what so ever. the encoded file had no
issues what so ever. :)

reasons i think this might happen:
1) remove the hardup option on the script
2) dumped the file directly from dvd: some users make theire back-ups by
dumping the .vob to the hdd's. and then dump the audio from that same .vob
file. like i've said: i didn't do this i dump firstly the video to an m2v
file and then dumped the audio.

resumed: it might be the hardup option or the .vob dumping one makes.

any thoughts?
regards,
zach

From: Zacharias <zach...@uymail.com>
> To: mplaye...@mplayerhq.hu
> Cc: gr...@gerg.ca, al...@roalter.it
> Subject: Re: [MPlayer-users] Audio sync problem with mencoder
>

> Ciao alex! :)
> well i do it so because one weird thing happened:
> i did dumped the .vob file through the command : mplayer dvd://1
> -dumpstream -dumpfile movie.vob and then encoded/did the rip from the
> .vobfile, but! there's a big issue here:
> i realised afterwards that the audio was not synched and another thing
> happened: the subtitles were burnt in the final coded videofile.avc or mkv
> for some weird reason.
>
> that's why i dump the video only and then the AC3 audio.
> any thoughts? with the synch and this subtitle thing
> regards,
> zach
>

Bernd Butscheidt

unread,
Mar 14, 2012, 10:23:52 AM3/14/12
to MPlayer usage questions, feature requests, bug reports
 
>________________________________
>From: Greg Ward gr...@gerg.ca

>
>Subject: Re: [MPlayer-users] Audio sync problem with mencoder
>
>Also, my home network is a mere 100 Mbits. When copying files from the
>PC to the living room, 1.5 GB is nicer than 6 GB. So space is a bit of
>a concern. I'd like to be able to transcode.
>
 If you still want to transcode, you can use your command as proposed

 
  mencoder dvd://1 -quiet \
    -oac copy \
    -ovc lavc \
    -lavcopts vcodec=mpeg4:vhq:vbitrate=2048:autoaspect=1 \
    -mc 0 -noskip \
    -o <outfile>

but:
- leave out all mc o and noskip stuff  
- don't use oac -copy, instead of this reencode both, video and(!) audio
 
With this, I get some duplicate frames or frame dropping messages especially at the beginning especially when using ts Streams with h264 video as input files, but the result is fine overall and the audio and video is in sync.
 
Of course, it is not very elegant to reencode the audio too, but for me there was never any audible disadvantage – but a great advantage: audio and video in sync!.
 
To my opionion the multimedia container certainly have additional information about the correct syncing of audio and video. If you separate them, these information get lost and you suffer because the remuxed video and audio are not in sync anymore.
 
ProjectX allows us to demux mpeg2 footage without getting into these troubles. I don't know a tool for other video formats which is like this. Unfortunately, demuxing with mencoder or ffmpeg seems to be no replacement for a tool like ProjectX . But in your case this seems to me a hard option:
-          rip the DVD as described in the previous posts
-          demux with Projectx
-          reencode the video
-          mux, eg. with mplex
Kind regards
Bernd B. 

mx2927

unread,
Mar 24, 2012, 10:49:35 AM3/24/12
to mplaye...@mplayerhq.hu
I got something similar, and solved with -mc 0 -vf harddup (no -noskip)

On 3/12/2012 3:36 PM, Alexander Roalter wrote:
> Am 12.03.2012 13:57, schrieb Zacharias:
>> im not that experienced. i ve jsut recentlymove to linux as my main
>> OS. but
>> acttualy i have the same issue.
>> i thought it would be something wrong with my config. i actually do dump
>> fisrtly the video woth no sound to m2v format, (i thnk. im not at home
>> atm
>> so i cant confirm) but i think youll get the point.
>> but when i mux the video and the audio in an mkv container, i get the
>> delay. its very weird.
>> any thoughts?
>>
>
> I'm no expert on this, but IIRC, the original video stream can contain
> additional sync information that gets lost if they are extracted
> separately and later muxed together. I don't know if that's the case in
> your situation, though
>

Reply all
Reply to author
Forward
0 new messages