ALSA - no surround playback with mplayer

3

When I run:

speaker-test -c6

...everything is fine. I get 5.1 playback.

However, when I run:

mplayer -channels 6 "some video with 5.1 audio"

no audio plays. Here is what appears in the terminal:

~$ mplayer /var/remote/projects/playback/video/calibration/5.1video/10000_bc-tlr2_h480p.mov 
MPlayer UNKNOWN-4.4.5 (C) 2000-2012 MPlayer Team
Playing /var/remote/projects/playback/video/calibration/5.1video/10000_bc-tlr2_h480p.mov.
libavformat version 53.31.100 (internal)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  848x352  24bpp  23.976 fps  2132.4 kbps (260.3 kbyte/s)
Clip info:
 major_brand: qt  
 minor_version: 537199360
 compatible_brands: qt  
 creation_time: 2008-01-08 00:00:27
 comment: Encoded and delivered by apple.com/trailers/
 comment-eng: Encoded and delivered by apple.com/trailers/
 copyright: © 2008 Warner Bros. Pictures. All Rights Reserved
 copyright-eng: © 2008 Warner Bros. Pictures. All Rights Reserved
 title: 10,000 BC
 title-eng: 10,000 BC

Load subtitles in /var/remote/projects/playback/video/calibration/5.1video/

==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 53.60.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)

==========================================================================

Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 6 ch, s16le, 465.9 kbit/10.11% (ratio: 58238->576000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))

==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2209:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
[AO_ALSA] Playback open error: No such file or directory
AO: [pulse] 48000Hz 6ch s16le (2 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 848x352 => 848x352 Planar YV12 
A:   0.1 V:   0.0 A-V:  0.084 ct:  0.004   0/  0 ??% ??% ??,?% 0 0 
[h264 @ 0xf0c760]Increasing reorder buffer to 1
A:  75.9 V:  75.9 A-V:  0.000 ct:  0.084   0/  0  4%  0%  0.5% 0 0 
Truncating packet of size 1173 to 500
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xe953e0]stream 1, offset 0x13dc10b: partial file
A:  76.3 V:  75.9 A-V:  0.395 ct:  0.084   0/  0  4%  0%  0.5% 5034 0 
[aac @ 0xf0c760]Input buffer exhausted before END element found
A:  76.3 V:  75.9 A-V:  0.396 ct:  0.084   0/  0  4%  0%  0.5% 5035 0 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xe953e0]stream 1, offset 0x13dc5ab: partial file
A:  76.3 V:  75.9 A-V:  0.396 ct:  0.089   0/  0  4%  0%  0.5% 5035 0 


Exiting... (End of file)

The most telling being the line:

[AO_ALSA] alsa-lib: pcm.c:2209:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51

Does anyone know of a way to simply force mplayer to use the same output path that is used by alsa's speaker-test utility?

Other advice?

For reference:

$ aplay -l

**** List of PLAYBACK Hardware Devices ****

card 0: DSP [Hammerfall DSP], device 0: RME Hammerfall DSP + Multiface [RME Hammerfall DSP + Multiface]

    Subdevices: 1/1
    Subdevice #0: subdevice #0

Linux Noob

Posted 2013-03-27T14:04:29.113

Reputation: 41

This question probably would feel more at home on http://unix.stackexchange.com

– Cestarian – 2016-03-06T10:05:47.093

Answers

1

Your ideas led me down the right road and I found an alias defined in hdsp.conf, which mplayer likes.

For reference, it's "hdsp_analog" and can be addressed in mplayer's command line:

mplayer -ao alsa:device=hdsp_analog -channels 6 /path/to/media.mov

Thanks every one.

Linux Noob

Posted 2013-03-27T14:04:29.113

Reputation: 41

You might want to know that alsa doesn't dmix 5.1 speaker setups by default (means you can only play one sound at a time, e.g. you can't play music and play a game at the same time) there is a workaround for this by manually creating dmix. https://dl.dropboxusercontent.com/u/18371907/asoundrc ; just in case you ever run into problems.

– Cestarian – 2016-03-06T10:08:02.887

0

The error Can't open audio device /dev/dsp: No such file or directory is at least one problem to start with. Try seeing if the file even exists ...

$ ls -l /dev/dsp

If it doesn't, there could be an issue with udev settings (/etc/udev/*) or there may be some other ALSA driver/hardware thing going on that prevents the device file from being created.

I believe aplay -l does direct hardware detection (kernel space) whereas mplayer is just trying to use a device listed in the /dev directory (user space).

What distro are you using?

Dave

Posted 2013-03-27T14:04:29.113

Reputation: 194

That error is just because mplayer by default attempts to use OSS, which is generally not in use on modern Linux systems, and as such the device doesn't exist. It's not related to OP's actual error. – ssmy – 2013-03-27T14:49:28.573

0

The Hammerfall DSP does not support outputting only 6 channels, so there is no surround51 alias for it.

Try mplayer -ao alsa:device=plughw=0 -channels 6 whatever.mov.

CL.

Posted 2013-03-27T14:04:29.113

Reputation: 1 351

I can't seem to target the device this way. When I use alsa:device=hw=0 (or 0.0), I receive an error saying that the card could not be found. I'll post the exact error when back in the office in a couple of days. – Linux Noob – 2013-03-28T16:41:07.113

Here's what I get:

$ mplayer -ao alsa:device=hw=0 -channels 6 /var/remote/projects/playback/video/calibration/5.1video/10000_bc-tlr2_h480p.mov

[AO_ALSA] Unable to set access type: Invalid argument Failed to initialize audio driver 'alsa:device=hw=0' Could not open/initialize audio device -> no sound. Audio: no sound

Any thoughts @CL.? Thanks a lot. – Linux Noob – 2013-03-30T06:30:36.260

The Hammerfall uses an unusual access type that isn't supported by mplayer (or many other programs), so you always have to use plughw instead of hw. – CL. – 2013-03-30T11:00:18.957