Results 1 to 5 of 5

Thread: Mencoder + Mplayer = Audio Delay?

  1. #1
    Join Date
    Jul 2006
    Location
    Newcastle, Australia
    Beans
    63
    Distro
    Ubuntu 12.04 Precise Pangolin

    Mencoder + Mplayer = Audio Delay?

    I've been encoding dvds to x264 and mp3 with a command resembling this:

    Code:
    mencoder -dvd-device /media/cdrom0 -alang en -ovc x264 -oac mp3lame -x264encopts "bitrate=1000" -o "/path/to/movie.avi" dvd://1
    When I play back the resulting avi file in totem, it plays fine. However, when I play it back with mplayer, the audio is out and I have to set audio delay to -500ms with the numpad minus key.

    Anyone have any idea why the audio would only play off-time in mplayer?
    respLect.com home of the stuff I do in my spare time. Some of it is kind of cool.
    Life is why I have to die today.

  2. #2
    Join Date
    Dec 2006
    Beans
    6,930

    Re: Mencoder + Mplayer = Audio Delay?

    Hi,

    Is it possible to post your file somewhere? It would be interesting to have a look at it.

    Have a look at:

    *********************************/matrix.html

    which demonstrates 2 pass h264 encoding. This is a technique I have been using for some time (it is my page) and there is no problem with AV sync. This might help you out little.

    Are you using a current mplayer? This can be demonstrate as follows:

    Code:
    andrew@skamandros~$ mplayer | head -n 1
    MPlayer dev-SVN-r28012-4.2.3 (C) 2000-2008 MPlayer Team
    All the best,

    Andrew
    You think that's air you're breathing now?

  3. #3
    Join Date
    Jul 2006
    Location
    Newcastle, Australia
    Beans
    63
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Mencoder + Mplayer = Audio Delay?

    My version is just the one from the intrepid repos:
    Code:
    MPlayer 1.0rc2-4.3.2 (C) 2000-2007 MPlayer Team
    I've attached the avi file. It's a whole dvd movie so I just started encoding and hit Ctrl-C after 4 secs (tell me if this means it is not in tact somehow).

    I don't think it is anything to do with x264 and passes because I get the same result when encoding to xvid. Having said that, I've never tried 2 pass x264 or xvid encoding (does xvid even support it?) My guess is that the problem is with the avi container, but other media players handle it fine.
    Attached Files Attached Files
    respLect.com home of the stuff I do in my spare time. Some of it is kind of cool.
    Life is why I have to die today.

  4. #4
    Join Date
    Dec 2006
    Beans
    6,930

    Re: Mencoder + Mplayer = Audio Delay?

    Hi,

    Unfortunately there was not enough to see the AV sync but I suspect there is probably a file size limit on these forums anyway. The MPlayer docs usually ask for file samples as follows:

    Code:
    dd if=yourfile of=smallfile bs=1024k count=5
    but this would probably still be a little big ...

    Have you thought of trying the svn MPlayer? There have been some improvements in decoding h264 videos since the old days of rc2 and this may help things a little. There is a guide on these forums for this:

    http://ubuntuforums.org/showthread.php?t=558538

    Xvid has 2 and even 3 pass available. Simply specify a first pass with:

    Code:
    -ovc xvid -xvidencopts pass=1
    and direct the output to /dev/null and then run:

    Code:
    -ovc xvid -xvidencopts pass=2
    with output to your filename.

    All the best,

    Andrew
    You think that's air you're breathing now?

  5. #5
    Join Date
    Jul 2006
    Location
    Newcastle, Australia
    Beans
    63
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Mencoder + Mplayer = Audio Delay?

    Thanks for the ideas. I'll try some multi-pass encoding I guess. It still puzzles me why other media players handle the video properly.

    EDIT: Found a solution. I first rip the dvd to the hard disk with:
    Code:
    mplayer -dvd-device /media/cdrom0 -dumpstream -dumpfile /path/to/uncompressed.VOB dvd://1
    Then run something like this:
    Code:
    mencoder -oac mp3lame -ovc xvid -xvidencopts "bitrate=1024" -o /path/to/compressed.avi /path/to/uncompressed.VOB
    This will also work with x264. My new guess is that the av-delay issue I was having had something to do with reading data from the dvd drive while encoding. Maybe DMA is not working properly? But then shouldn't I notice skippy dvd playback? Who knows. The point being, doing a rip to the hard disk first, then encoding from there solves the issue.
    Last edited by fatalGlory; December 4th, 2008 at 07:54 AM.
    respLect.com home of the stuff I do in my spare time. Some of it is kind of cool.
    Life is why I have to die today.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •