[MPlayer-users] Getting the best sound from mplayer

Grant emailgrant at gmail.com
Fri Jul 22 22:20:14 CEST 2011


...
>> If not, is there any way to select a higher quality resampling than
>> the default in mplayer?
>
> From manpage:
>       -srate <Hz>
>              Select the output sample rate to be used (of course sound cards have limits on this).  If the  sample  frequency
>              selected is different from that of the current media, the resample or lavcresample audio filter will be inserted
>              into the audio filter layer to compensate for the difference.  The type of resampling can be controlled  by  the
>              -af-adv option.  The default is fast resampling that may cause distortion.
>
> lavcresample provides satisfactory resampling when it's set for high
> quality mode. So just try selecting higher quality mode for audio
> filters with -af-adv (check manpage).

According to the manpage, '-af-adv force=1' (optimized for accuracy)
is the default.  Is floating point processing with force=5 better?
lavcresample is used by default according to this:

http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2004-December/032119.html

> Other than that, I can recommend you to check out pulseaudio again. It's
> simplest way to get guaranteed high quality audio both for mplayer and
> all other sources; you can select high quality resampling there
> (note, that *very highest quality* eats too much cpu and badly affects
> latency under load, too), including libsamplerate_best or ffmpeg's
> lavcresample and some others, and permanently lock output to, say,
> 24/96 mode.
>
>> I tried this:
>>
>> mplayer -channels 6 -ao alsa:device=plughw=0.0 -format s24le title.mkv
>>
>> but got the same results with missing sound.  Shouldn't ALSA downmix
>> the 6 channels to 2 if I specify plughw like this?
>
> No, plughw only does very necessary convertions to allow output to work
> at all and never any extra. Like, for example, if you feed 44100 but
> your audio card supports only 48k samples, it will convert 44.1->48 but
> nothing else; or if you feed 16 bit stream to it but your sound card
> supports only 24-bit sampled audio, it will convert s16 to s24. It can
> upconvert stereo to multichannel (by simply filling other channels with
> silence) for sound cards that accept only multichannel - there are such
> beasts - but it will never do any extra steps, not to introduce
> undesirable effects. Basically plughw is just "compatible" version of hw
> that takes care of most obvious incompatibilities which make playback
> impossible; as long as playback IS possible, plughw does no conversion.

Got it.

> You can try setting up your own alsa device, though I doubt there is alsa
> filter equivalent to "pan" in mplayer. But maybe there is one.
>
>>
>> Does mplayer resample to 16/48 regardless of the source's sample size and rate?
>
> No, it will pass output as is. Maybe with *some* specific output drivers
> it can change sample size or rate automatically, when output driver
> demands some type of stream, not sure, but it's not the common case.

Doesn't resampling need to take place in order to downmix the 6
channels to 2?  My question was meant in the context of that downmix
and resampling.

> Like I said, probably simplest way to ensure that no application ever
> changes sample rate or size (well, almost; you obviously can't control
> all cases, but most important applications won't) is to use pulseaudio
> with output locked to 96/24 or similar. With that, every application
> always feeds unaltered stream to pulse and all conversions take place
> only in pulseaudio, where you ensure that they are high quality.
>
> Though, pulseaudio won't be doing multichannel-to-stereo conversion; you
> still have to do it in mplayer.

It's too bad pulseaudio can't downmix.

Thanks a lot for your help Vladimir.

- Grant


More information about the MPlayer-users mailing list