You are not logged in.

#1 2010-05-26 08:59:41

Registered: 2009-02-03
Posts: 1,098

"true" surround in mplayer/gstreamer with alsa?


I have a 5.1 sound system connected to my onboard sound card:

00:05.0 Audio device: nVidia Corporation MCP61 High Definition Audio (rev a2)

It has only three jacks for Line in/out, mic and speakers but can be configured in the mixer for 6-Channel mode.
Stereo sound is automatically upmixed and put out on all speakers. (I like that)
I set my default soundcard with asoundconf (from AUR) but tested it also after deleting ~/.asoundrc* with same results.

When I test the surround with

speaker-test -c 6 -D surround51 -t wav

it works well and I get "true" surround.

I found a good ac3 test file: … d_test.ac3

When playing in VLC I can set the audio device to 5.1 and get the right surround sound too. So it actually does work.

But when I try the file in mplayer it only is stereo upmixed to all channels.
I tried mplayer with -channels 6 but got an error:

~ % mplayer -channels 6 Desktop/www_lynnemusic_com_surround_test.ac3
MPlayer SVN-r31027-4.5.0 (C) 2000-2010 MPlayer Team
150 audio & 332 video codecs
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing Desktop/www_lynnemusic_com_surround_test.ac3.
libavformat file format detected.
[ac3 @ 0x9c231e0]max_analyze_duration reached
[ac3 @ 0x9c231e0]Estimating duration from bitrate, this may be inaccurate
[lavf] Audio stream found, -aid 0
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 6 ch, s16le, 448.0 kbit/9.72% (ratio: 56000->576000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
[AO_ALSA] alsa-lib: pcm_hw.c:448:(snd_pcm_hw_sw_params) SNDRV_PCM_IOCTL_SW_PARAMS failed (-22): Invalid argument
[AO_ALSA] Unable to get sw-parameters: Invalid argument
Failed to initialize audio driver 'alsa'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video

Exiting... (End of file)

I wonder if VLC is not using alsa directly for surround sound because there it works...

When I use mplayer with -ao sdl it is a bit better with the front channels but the center sound is very scratchy and the center also plays with the rear speakers.

I also tried totem with 5.1 Audio output set in the preferences. It has no effect and sounds exactly the same like 2.0. I guess it does fallback when 5.1 is not working... (I don't get error output on commandline)

So is there a way to get VLC's behaviour in all programs or do I have to create a surround device in the asoundrc (I don't like this)?

Last edited by Cdh (2010-05-26 21:48:40)

฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz


#2 2010-05-26 21:18:41

Registered: 2009-02-03
Posts: 1,098

Re: "true" surround in mplayer/gstreamer with alsa?

Next edit:

I found a step to the solution here: … ound_sound


pcm.!default {
     type plug
     slave.pcm "duplex"

pcm.snd_card {
     type hw
     card 0 # change to your cards number or name

# 6 channel dmix:
pcm.dmix6 {
     type dmix
        ipc_key 1024
        ipc_key_add_uid false # let multiple users share
        ipc_perm 0660 # IPC permissions (octal, default 0600)
        slave {
                pcm snd_card # see below
                rate 48000
                channels 6

pcm.duplex {
     type asym
     playback.pcm "dmix6"  # just pass to 6 channel dmix
     capture.pcm "snd_card"

Then it works in mplayer with channels=6 with dmix.
Unfortunately in totem it is still upmixed stereo and in Flash I have no sound at all so this is no solution.

Last edited by Cdh (2010-05-26 21:50:35)

฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz


#3 2010-06-30 15:20:36

From: Athens - Greece
Registered: 2007-03-29
Posts: 327

Re: "true" surround in mplayer/gstreamer with alsa?

This must be an issue with the new kernel 2.6.34.


#4 2010-06-30 15:59:36

Registered: 2009-02-03
Posts: 1,098

Re: "true" surround in mplayer/gstreamer with alsa?

Ah, forgot about this topic.
What I found out:
When choosing 5.1 in VLC it uses the alsa device directly. No other sound can be played except vlc when it is enabled.

In (S)mplayer you have to choose the alsa device directly AND use -channels=6, then you have surround at the cost of not being able to play any other sound either.

I have found no other solution.

Last edited by Cdh (2010-06-30 15:59:57)

฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz


#5 2010-06-30 17:14:55

Registered: 2007-04-03
Posts: 3,742

Re: "true" surround in mplayer/gstreamer with alsa?

See better dmix, and my config file at the end of the thread.


Board footer

Powered by FluxBB