Author Topic: Mplayer Audio Sync  (Read 15295 times)

Rodre

  • Newbie
  • *
  • Posts: 12
    • View Profile
Mplayer Audio Sync
« on: January 08, 2007, 12:39:24 pm »
Hello,

I have a C760 running Cacko 1.23. I have encoded a DVD using mencoder and various other retail dvd encoders from pinnacle, Intervideo, and 123 Copy DVD. My problem is that when I play the ripped/encoded dvd file on my desktop the audio and video are synced perfectly, but when I play the video on my Z in mplayer the audio is 2-3 seconds faster than the video. What gives? How are others playing video on their Z? I have also encoded a .mpg file shot with my handycam and it does the same thing.

It appears that mplayer has the ability to resync the audio using either the + and - keys or by using a '-delay' switch on startup, but it appears that the mplayer for the Z either doesn't support this or doesn't have the input key mapping file. Does anyone know about this file?

~Rodre
« Last Edit: January 08, 2007, 12:39:51 pm by Rodre »

Serge

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Mplayer Audio Sync
« Reply #1 on: January 08, 2007, 06:05:53 pm »
AFAIK mplayer has troubles with variable bitrate mp3 audio in libmad decoder. See more details and a link in the first post from this thread: https://www.oesf.org/forums/index.php?showt...ndpost&p=148188

You can try encoding constant bitrate audio or use '-ac ffmp3' decoder. Please report if that information helped to resolve your issue.
Siarhei Siamashka (ssvb on #maemo, irc.freenode.net)
currently taking part in porting MPlayer to Nokia 770 and Nokia N800, feel free to join :)

Rodre

  • Newbie
  • *
  • Posts: 12
    • View Profile
Mplayer Audio Sync
« Reply #2 on: January 08, 2007, 08:12:20 pm »
Hi Serge, thanks for your response.

I tried the '-ac ffmp3' flag in kino2's "preferences" (File -> Preferences... -> Options for mplayer) and that didn't work. I am a newbie when it comes to encoding video. Can you tell me what mencoder flags I can use to encode the audio stream with a constant bitrate? I am looking to get the best quality sound and video as file size doesn't matter to me because I have a 4GB SD card.

Also, is there any way to get mplayer to accept the - and + keys so that I could adjust the lag on the fly? The "o" for on screen display works, but not many of the other ones. Thanks.

~Rodre

Serge

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Mplayer Audio Sync
« Reply #3 on: January 09, 2007, 01:38:32 am »
Quote
I tried the '-ac ffmp3' flag in kino2's "preferences" (File -> Preferences... -> Options for mplayer) and that didn't work.
Did it refuse to run with this option? Or you still have this audio sync problem? Also please report what version of mplayer are you using.

Quote
I am a newbie when it comes to encoding video. Can you tell me what mencoder flags I can use to encode the audio stream with a constant bitrate? I am looking to get the best quality sound and video as file size doesn't matter to me because I have a 4GB SD card.
man mencoder, search for 'lameopts' there.
« Last Edit: January 09, 2007, 01:38:56 am by Serge »
Siarhei Siamashka (ssvb on #maemo, irc.freenode.net)
currently taking part in porting MPlayer to Nokia 770 and Nokia N800, feel free to join :)

Rodre

  • Newbie
  • *
  • Posts: 12
    • View Profile
Mplayer Audio Sync
« Reply #4 on: January 09, 2007, 03:00:53 am »
Hi Serge,

It ran but the audio was still faster than the video. mplayer version is:

MPlayer 1.0pre7-3.4.2 for Zaurus 1.1.5

I will check the lameopts for constant bit rate and re-encode and see what happens.

~Rod

Serge

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Mplayer Audio Sync
« Reply #5 on: January 10, 2007, 05:13:25 pm »
Well, don't know then, ffmp3 decoder should have correct audio/video sync. This problem could be also audio driver related, but as I don't have zaurus myself, I can't help much here. Anyway, did you try playing this movie using mplayer on desktop pc just to check if this problem is really zaurus specific (and not a result of bad encoding)?
Siarhei Siamashka (ssvb on #maemo, irc.freenode.net)
currently taking part in porting MPlayer to Nokia 770 and Nokia N800, feel free to join :)

Rodre

  • Newbie
  • *
  • Posts: 12
    • View Profile
Mplayer Audio Sync
« Reply #6 on: January 10, 2007, 10:43:55 pm »
Hi Serge,

Yes the file plays fine on my deskyop using mplayer. I am pretty sure that you are on the right track because I re-encoded the file using windows media encoder 9 (blah) and the audio/video rates were synced, but I lost a lot of the video quality. Is there a way I can have my mplayer on zaurus tell me what -ac audio decoders it supports?

~Rodre

Serge

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Mplayer Audio Sync
« Reply #7 on: January 11, 2007, 02:14:58 am »
Well, now I think everything can have quite a simple explanation  Your zaurus is just not fast enough to process video and audio in real time. So it is able to process audio, but can't also decode video in time so it lags behind. Did you get error messages from mplayer about your system being too slow to play this video? Adding -framedrop option can help to fix this problem at the cost of dropping some frames, but only if mplayer is still able to decode video in time (without displaying and scaling it).

You can do some benchmarking to get more information about how much cpu is used for decoding video, showing it to screen and audio (see -benchmark option in mplayer man).
« Last Edit: January 11, 2007, 02:15:29 am by Serge »
Siarhei Siamashka (ssvb on #maemo, irc.freenode.net)
currently taking part in porting MPlayer to Nokia 770 and Nokia N800, feel free to join :)

Rodre

  • Newbie
  • *
  • Posts: 12
    • View Profile
Mplayer Audio Sync
« Reply #8 on: January 11, 2007, 02:47:49 am »
I Encoded it using these instructions:

https://www.oesf.org/index.php?title=Mencoder_Encoding

Specifically:

mencoder dvd://1 -srate 24000 -vop scale=320:240 -o office_space.avi -oac mp3lame -lameopts preset=15:mode=3 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=150 -ofps 15 -sws 2

and it does the same thing.

I still have to try and re-encode using CBR. I guess I'll see what happens then.

Thanks for your advice, it still really helped me.

~Rodre
« Last Edit: January 11, 2007, 02:48:25 am by Rodre »

bubox

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://
Mplayer Audio Sync
« Reply #9 on: January 24, 2007, 02:14:24 am »
Quote
I Encoded it using these instructions:

https://www.oesf.org/index.php?title=Mencoder_Encoding

Specifically:

mencoder dvd://1 -srate 24000 -vop scale=320:240 -o office_space.avi -oac mp3lame -lameopts preset=15:mode=3 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=150 -ofps 15 -sws 2

and it does the same thing.

I still have to try and re-encode using CBR. I guess I'll see what happens then.

Thanks for your advice, it still really helped me.

~Rodre
[div align=\"right\"][a href=\"index.php?act=findpost&pid=150782\"][{POST_SNAPBACK}][/a][/div]

Rodre,

any luck?  I've got the exact same issue: audio faster than video (out of sync) issues with my c700.

I've been trying a bunch of different encoding options in ffmpeg and mencoder and haven't quite go t it yet.  please let me know if you find the magical encoder combination.  

I'll post if I stumble on the answer.

bubox
sl-c700
1GB sd Toshiba
Cacko 1.23
Big 2000mAh batt

bubox

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://
Mplayer Audio Sync
« Reply #10 on: January 25, 2007, 08:26:57 am »
Rodre,

I've got video playing on my c700 with audio and vid in sync.  Thanks to Serge for his last post about the cpu not being fast enough.  My previous attempt involved finding the perfect codec, but what I really needed to do was crunch the vid down a little more.

Once I cut the fps down to 15 things got better sync-wise.  It's still faily viewable.  The -b parameter is bitrate, so first try that at 300 or 400 and see if it will work, then work your way down.

Here's what working for my c700:
Code: [Select]
ffmpeg -i infile.avi -b 200 -s 320x240 -r 15 -vcodec mpeg4 out.avi

add this:
Code: [Select]
-ss 00:00:00 -t 00:00:30to encode the first 30 seconds only as a test.  

questions:
is mono audio less cpu intensive?
is two-pass encoding more cpu intensive?


I think I can eek out a bit more quality without pushing the cpu with some two-pass encoding.  That's next.

regards,

bubox
« Last Edit: January 25, 2007, 08:38:22 am by bubox »
sl-c700
1GB sd Toshiba
Cacko 1.23
Big 2000mAh batt