[mythtv-users] Re: mplayer audio sync issues

Michael T. Dean mtdean at thirdcontact.com
Wed Jun 8 20:41:24 UTC 2005

James Stembridge wrote:

>On 6/8/05, Adam Gianola <devils.taco at gmail.com> wrote:
>>I checked it out, and I have the same results.  When I explicitly tell
>>mplayer to use '-ao oss' there is no sync issue.  When I have '-ao
>>alsa', the audio and video don't match (audio too late).
>Perhaps your new alsa is using dmix by default?
It probably is, but that's not the problem.  If dmix caused a delay of 
0.275s, it would be useless...

ALSA 1.0.9 uses the dmix plugin by default on all soundcards that lack 
hardware mixing support (previous versions required you to explicitly 
request dmix).  So, what does this mean?  Well, if you play any audio 
via an ALSA driver whose soundcard doesn't support hardware mixing and 
you specify ALSA's "default" device (i.e. aplay -D default 
/path/to/audio_file or aplay /path/to/audio_file)--and you have *not* 
redefined the default device--ALSA will automatically enable the dmix 
plugin (and, since dmix requires a specific type of audio, the plug 
plugin is used to do automatic conversion).  However, if you specify the 
"recommended" (i.e. not very useful) .asoundrc--i.e.

pcm.somename {
  type hw
  card 0

ctl.somename {
  type hw
  card 0

and play audio on that device (i.e. aplay -D somename 
/path/to/audio/file), ALSA does exactly what you asked (i.e. sends the 
audio directly to the hardware--which is likely to fail since most sound 
cards lacking hardware mixing also require a specific format of audio, 
such as 48KHz PCM).

Note that for those users who are using the .asoundrc I posted a while 
back (i.e. the one in the DigitalSoundHOWTO at 
http://mythtv.info/moin.cgi/DigitalSoundHowTo), there's no benefit to 
changing your default device back to the ALSA default.  The "digital 
sound" .asoundrc is more explicit than it need be, but this is probably 
a good thing--since it's not dependent on a specific version of ALSA or 
a specific device name (i.e. you can use default, analog, mixed-analog, 
digital, or mixed-digital to get exactly what you want).  And, since 
those who uncomment the appropriate lines in the top section are 
completely redefining the default device, you don't have to worry about 
dmix'ing the dmix'ed sound (i.e. it doesn't get dmix'ed twice).  
Therefore, I recommend not changing your .asoundrc.

BTW, I have an nForce2-based sound card (which lacks hardware mixing 
support), and am using ALSA 1.0.9 with MPlayer compiled against 
alsa-libs-1.0.9 and sync is perfect--whether I delete my .asoundrc and 
use the default device, use the "recommended" .asoundrc with the default 
device, or use the "digital sound" .asoundrc with the default or 
mixed-analog device (don't have any digital output on that system, but I 
sincerely expect it to work with digital output, also).  I also have a 
SB Live! (which has hardware mixing support) and it works in the 
previously mentioned configurations, also.


More information about the mythtv-users mailing list