Author Topic: Mplayer sound out of sync.  (Read 5857 times)

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« on: April 10, 2004, 10:24:49 pm »
I just got mplayer working with my videos.  Used the script I found on zug.  But for some reson the sound becomes out of sync about 10 mins into the file.  Does any one know howto fix this.  I am useing a sl-5500 oz 335.  Thx in ADV.

JP

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Mplayer sound out of sync.
« Reply #1 on: April 11, 2004, 01:19:22 am »
Look at the status line of mplayer. If you can run it via ssh, the status line should be visible on your terminal.  


Q: What is the meaning of the numbers on the status line?
        A: Example: A: 2.1 V: 2.2 A-V: -0.167 ct: 0.042 57/57 41% 0%
        2.6% 0 4 49%
              * A: audio position in seconds
              * V: video position in seconds
              * A-V: audio-video difference in seconds (delay)
              * ct: total A-V sync correction done
              * frames played (counting from last seek)
              * frames decoded (counting from last seek)
              * video codec cpu usage in percent (for slices and DR this
                includes video_out)
              * video_out cpu usage
              * audio codec cpu usage in percent
              * frames needed to drop to maintain A-V sync
              * current level of image postprocessing (when using
                -autoq)
              * current cache size used (around 50% is normal)


Look at the value of A-V:. It should be a very small number close to zero.
Look at frames needed to drop to maintain A-V Sync (third from right).  

My guess is that you are dropping  a lot of frames during playback and not enough to maintain A-V sync.  You might try to reduce the bitrate, or reduce the framerate on encode.
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Mplayer sound out of sync.
« Reply #2 on: April 11, 2004, 02:03:15 am »
or did you run mplayer with the -framedrop option?
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #3 on: April 11, 2004, 09:13:58 am »
Ok just ran mplayer on my zaurus over ssh.  There is no status line.  I encoded this move with 15 fps and a bitrate of 150.  I got the script form this site http://cmisip.home.insightbb.com/zaurus.htm .  And I did not run mplayer with the -framedrop option.  

JP

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Mplayer sound out of sync.
« Reply #4 on: April 11, 2004, 03:22:18 pm »
Forget my first post, just run mplayer this way :

nice -n -5 mplayer -dr -lavdopts idct=7 -cache 2048 -framedrop -quiet videofile.ogm

Do it outside of qtopia.

If you still have problems, try running with -hardframedrop instead
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #5 on: April 11, 2004, 04:49:06 pm »
Did not work.  I have also found out that the sound does go out of sync when I play it on my laptop.

JP

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Mplayer sound out of sync.
« Reply #6 on: April 11, 2004, 05:39:15 pm »
There is an audio video sync problem with conversion of movies to ogm.  That is why there is an audio delay parameter. This seems to vary but for my use 200 ms seems to work fine.    In the first version of the script, the audio delay parameter was incorreclty typed.  It was missing the $.   However this a-v sync problem should be constant throughout the playback of the file which is why it can be corrected with the -delay option in mplayer.    It would be nice if you can see the output of the status line of mplayer to see what is really happening.   When you tried with ssh, make sure to not run mplayer with the -quiet option.  See what happens with the status line in your laptop first.     Let me know what happens with A-V:
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Mplayer sound out of sync.
« Reply #7 on: April 11, 2004, 05:41:48 pm »
By the way, if you can\'t see the status line even if you don\'t specify the -quiet in the command line, your config file may have it enabled.  Look for your config file in the usual locations ( ~/.mplayer  or wherever else mplayer looks for it.)
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #8 on: April 11, 2004, 06:36:34 pm »
Here is the status line form my SL-5500.
A: 337.7 V: 337.8 A-V: -0.054 ct:  0.129  5068/5068  51% 16% 12.7% 76 0 0%
And form my laptop.
A: 334.6 V: 334.6 A-V:  0.032 ct:  0.078  5021/5021   1%  0%  0.7% 2 0 0%

Here is my mplayer.conf file form my Z.
vo = fbdev
#quiet = yes
ao = oss
fb = /dev/fb0
framedrop = yes

And the one on my laptop is emptey.
One more thing after I commented out quiet=yes I can now get the status line.
JP

lbotez

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #9 on: April 11, 2004, 06:45:23 pm »
Has anyone gotten VLC to work on the Z?  Last time I checked, they had code, but didn\'t have Zaurii to try it out.

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Mplayer sound out of sync.
« Reply #10 on: April 11, 2004, 07:07:35 pm »
The value o A-V: is pretty close to zero which is good.  But this is just a snapshot of the entire movie.  Is this pretty much the case for the entire movie?  If that is the case, it should have pretty good A-V sync.    There are some dropped frames but that shouldn\'t be too bad.  If your A-V: is pretty close to zero all the time during playback, then the problem might be the audio stream is ahead or behind the video stream during encode.  If that is the case a -delay option should fix the problem.

Experiment with mplayer playback on the encoded video file first.  If the audio is ahead of the video, use a delay with a negative number.  For example, to delay the audio by 200 ms, use -delay -.2 (mplayer values are entered in seconds).   Once you have figured out this magic number, use that on your encode script.  Like I said, I use 200 ms and it works pretty well for me.  

Don\'t expect perfect sync all the time though as mplayer is always struggling to keep the A-V sync and some frames just are harder to decode than others.   The A-V: value will not always be close to zero but it should be pretty close.  If you fast forward or rewind, you will see the A-V: value jump up and then gradually go down to near zero.

If that still does not fix your problem, try experimenting with lower bitrates and  resolutions.  The zaurus 5500 I think has a 200 Mhz processor whereas the 5600 (which I have) has a 400 Mhz one.  You however have the benefit of more memory.

If you still have version 1.0 of the createogm script, fix the AV_DELAY variable in ogmmerge by adding the $ in front of it.
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #11 on: April 11, 2004, 07:47:25 pm »
I have already fixed the AV_DELAY.  And like I siad the moive plays fine for about 10 min or so than it becomes out of sync.  I will play around with the sound dely and see how that goes.  Thx for the help.

JP

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #12 on: April 12, 2004, 11:58:38 am »
Ok I have tryed the -delay and -autosync both have had no effect.  I should also note that the status lines I had posted was form where the sound goes out of sync.  I am going to try the v1.1 script and see how that goes.

JP

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #13 on: April 12, 2004, 12:03:36 pm »
In your script there is option that reads cbp.  When ever I run mplayer to encode with this I get \"Option lavcopts: Unknown suboption cbp\".  I also took a look at the other script v1.0 and remenbuerd that in oreder for me to run the script  I had to delete this suboption could that be the cause of my problume?

JP

Joshp

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • http://
Mplayer sound out of sync.
« Reply #14 on: April 12, 2004, 09:48:00 pm »
So far no luck I tryed recodeing with your new script and had the same problum.  I am wondering about that cdp suboption.  And also way the sound becomes out of sync about 10 min into the move and not right away.  Any more ideas?

JP