Help - Search - Members - Calendar
Full Version: Mplayer sound out of sync.
OESF Forums > General Forums > General Support and Discussion > Software
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.

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
* 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.
or did you run mplayer with the -framedrop option?
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 . And I did not run mplayer with the -framedrop option.

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
Did not work. I have also found out that the sound does go out of sync when I play it on my laptop.

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:
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.)
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.
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.
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.
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.

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.

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?

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?

Are you using the latest vesrion of mplayer on your laptop?
I am useing mplayer 1.0pre3try2-3.2.3
are you using the latest version of mplayer/mencoder to encode?
As far as I know I download mplayer and compiled it a few days ago. I download it form mplayers main site. What is cdp?

Sorry for the double post, I didn't realize this was two pages already.

I am stumped as to what's causing your problem. If you read my site, it explains where I got the cbp setting. man mplayer would give you more information.

You might try not using ogg. Instead encode the movies to divx with mp3 sound. In this way, mencoder does not have to separate the audio from the video stream. You might maintain better sync. You are probably going to need the mad library to decode this on the zaurus as fpu emulation is very slow and impractical.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.