mplayer : audio device got stuck

If mplayer is displaying errors messages quite often like this one : “audio device got stuck”, here is a workaround. Add the following option :

-ao alsa:device=hw=0.0

How to find the information following the -ao option?

ALSA utility aplay may help you :

fool@localhost:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
Subdevices: 0/1
Subdevice #0: subdevice #0

As indicated here (using ALSA device within mplayer) , to use this only ALSA device available on this host, you have to type : alsa:device=hw=0.0

No more use of pulseaudio for mplayer. The program is accessing ALSA layer directly.

[AO_ALSA] alsa-lib: conf.c:3406:(config_file_open) /usr/share/alsa/pulse-alsa.conf may be old or corrupted: consider to remove or fix it

With the recent upgrade of pulseaudio to version 1.1-3, you will probably encounter error messages while playing an audio file as the ones below :

[AO_ALSA] alsa-lib: conf.c:1220:(parse_def) show is not a compound
[AO_ALSA] alsa-lib: conf.c:1686:(snd_config_load1) _toplevel_:24:26:Unexpected char
[AO_ALSA] alsa-lib: conf.c:3406:(config_file_open) /usr/share/alsa/pulse-alsa.conf may be old or corrupted: consider to remove or fix it

I had the messages above with mplayer while listening to an on-line radio.

After searches, this has been recently filed as a bug : Debian bug 661095

Look at the following configuration file : /usr/share/alsa/pulse-alsa.conf

Make a copy of it before doing any changes :

root@localhost:~# cp /usr/share/alsa/pulse-alsa.conf /usr/share/alsa/pulse-alsa.conf.save

With your favorite text editor, remove all the lines starting at line 20 until the last line. Here is what you should have at last :

root@localhost:~# cat /usr/share/alsa/pulse-alsa.conf

# This file is referred to by /usr/share/alsa/pulse.conf to set pulseaudio as
# the default output plugin for applications using alsa when PulseAudio is
# running.

pcm.!default {
    type pulse
    hint {
        show {
            @func refer
            name defaults.namehint.basic
        }
        description “Playback/recording through the PulseAudio sound server”
    }
}

ctl.!default {
    type pulse
}

You can now play any audio file with no more error messages.

Hope this help !

audio codec family [mpg123] (afm=mpg123) not available

This message can occur while listening to a webradio with mplayer. Here is a more detailed message :

Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 96.0 kbit/3.40% (ratio: 12000->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)

To use this codec without compiling mplayer again, install the following Debian package :

root@localhost:~#apt-get install libmpg123-0

Then, enable the use of this codec within your own mplayer configuration file :

fool@localhost:~$echo “afm=mp3lib” >> ~/.mplayer/config

This option will force mplayer to use mpg123 codec instead of ffmp3float.

More information on mpg123 by Thomas Orgis from the official mpg123 website  :

You need libmpg123 for the mpg123 codec in MPlayer, but the mp3lib codec is an internal fork of mpg123 code that fully resides in MPlayer.

So, if you want to use mp3lib, you can just say that in your ~/.mplayer/config … if you want mpg123, you need the lib and also MPlayer must be built with the codec enabled. Note that mp3lib will vanish sometime in favour of mpg123 usage (or ffmp3float, but I naturally hope the former;-), after some quirks have been settled.”

mplayer: Symbol `ff_codec_wav_tags’ has different size in shared object, consider re-linking

When upgrading from stable to testing, consider commenting the lines concerning the unofficial Debian ftp servers. Once done, after the upgrade, check whether you still have installed packages coming from other sources, like debian-multimedia.

While lauching mplayer, here are the errors I got :

mplayer: Symbol `ff_codec_wav_tags’ has different size in shared object, consider re-linking
mplayer: Symbol `ff_codec_bmp_tags’ has different size in shared object, consider re-linking

With dpkg -p mplayer, I noticed that mplayer’s version came from on unofficial source. And so are the depending packages.

In order to remove the error messages, remove the following packages :

fool@localhost:~$ dpkg -l | grep -E ‘(libavcodec52|libavcodec-extra-52|libavdevice52|libavdevice-extra-52|libavfilter1|libavfilter-extra-1|libavformat52|libavformat-extra-52|libavutil50|libavutil-extra-50|libpostproc51|libpostproc-extra-51|libswscale0|libswscale-extra-0)’

ii  libavcodec52                          5:0.6.1+svn20101128-0.2           library to encode decode multimedia streams – runtime files
ii  libavdevice52                         5:0.6.1+svn20101128-0.2           ffmpeg device handling library
ii  libavfilter1                          5:0.6.1+svn20101128-0.2           a graphics library;
ii  libavformat52                         5:0.6.1+svn20101128-0.2           ffmpeg file format library
ii  libavutil50                           5:0.6.1+svn20101128-0.2           avutil shared libraries – runtime files
ii  libmythavcodec52                      0.24.1-0.0squeeze1                libavcodec52 package for MythTV.
ii  libmythavutil50                       0.24.1-0.0squeeze1                libavutil50 package for MythTV.
ii  libmythswscale0                       0.24.1-0.0squeeze1                libswscale0 package for MythTV.
ii  libpostproc51                         5:0.6.1+svn20101128-0.2           postproc shared libraries
ii  libswscale0                           5:0.6.1+svn20101128-0.2           ffmpeg video scaling library

Some troubles with ffmpeg as well :
The following packages have unmet dependencies:
 ffmpeg : Depends: libavcodec52 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libavcodec-extra-52 (< 4:0.6.2-99) but it is not installable
          Depends: libavdevice52 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libavdevice-extra-52 (< 4:0.6.2-99) but it is not installable
          Depends: libavfilter1 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libavfilter-extra-1 (< 4:0.6.2-99) but it is not installable
          Depends: libavformat52 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libavformat-extra-52 (< 4:0.6.2-99) but it is not installable
          Depends: libavutil50 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libavutil-extra-50 (< 4:0.6.2-99) but it is not installable
          Depends: libpostproc51 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libpostproc-extra-51 (< 4:0.6.2-99) but it is not installable
          Depends: libswscale0 (< 4:0.6.2-99) but 5:0.6.1+svn20101128-0.2 is to be installed or
                   libswscale-extra-0 (< 4:0.6.2-99) but it is not installable
E: Broken packages

Remove all the broken packages with the following command-line :

root@localhost:~# apt-get purge libavcodec52 libavdevice52 libavfilter1 libavformat52 libavutil50 libpostproc51 libswscale0

Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following packages were automatically installed and are no longer required:
  libboost-regex1.42.0 libclutter-gst-1.0-0 libcheese1 libclutter-gtk-1.0-0 dvdauthor libgee2 libcluttergesture-0.0.2-0
  libgtkmm-2.4-1c2a bombono-dvd-data libmx-1.0-2 libxml++2.6-2 libcheese-gtk20 scons libboost-filesystem1.42.0 libmlt-data
  libclutter-imcontext-0.1-0 libboost-system1.42.0
Use ‘apt-get autoremove’ to remove them.
The following packages will be REMOVED:
  bombono-dvd* cheese* dvgrab* frei0r-plugins* gnash* gnash-common* gnome-video-effects* kino* libasound2-plugins*
  libavcodec52* libavcore0* libavdevice52* libavfilter1* libavformat52* libavutil50* libcvaux2.1* libhighgui2.1*
  libmjpegtools-1.9* libpostproc51* libquicktime1* libquicktime2* libsox-dev* libsox-fmt-all* libsox-fmt-ffmpeg*
  libswscale-dev* libswscale0* libxine1-ffmpeg* libxine1-plugins* mjpegtools* mplayer* swfdec-gnome* vlc* vlc-nox*
  vlc-plugin-notify* vlc-plugin-pulse* xine-ui*
0 upgraded, 0 newly installed, 36 to remove and 0 not upgraded.
After this operation, 70.9 MB disk space will be freed.

Uninstall ffmpeg, ffmpeg-doc, mplayer and mplayer-doc as well :

root@localhost:m~#apt-get purge ffmpeg ffmpeg-doc mplayer mplayer-doc

Reinstall all of them. This time, all the packages will be fetched from the official Debian repositories :

root@localhost:~#apt-get install ffmpeg ffmpeg-doc
Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following packages were automatically installed and are no longer required:
  libva-x11-1 libboost-regex1.42.0 libxcb-keysyms1 libclutter-gst-1.0-0 libtar0 libcheese1 libcddb2 libclutter-gtk-1.0-0
  libdvbpsi7 dvdauthor libgee2 libupnp3 libgavl1 libcluttergesture-0.0.2-0 libgtkmm-2.4-1c2a libxcb-randr0 libcv2.1
  bombono-dvd-data libmx-1.0-2 libxml++2.6-2 libcheese-gtk20 scons libboost-filesystem1.42.0 libmlt-data
  libclutter-imcontext-0.1-0 libebml3 libboost-system1.42.0 libmatroska4
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
  libav-doc libavcodec52 libavdevice52 libavfilter1 libavformat52 libavutil50 libpostproc51 libswscale0
The following NEW packages will be installed:
  ffmpeg ffmpeg-doc libav-doc libavcodec52 libavdevice52 libavfilter1 libavformat52 libavutil50 libpostproc51 libswscale0
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.0 MB of archives.
After this operation, 141 MB of additional disk space will be used.

root@localhost:~# apt-get install mplayer mplayer-doc
Reading package lists… Done
Building dependency tree       
Reading state information… Done
mplayer-doc is already the newest version.
The following packages were automatically installed and are no longer required:
  libva-x11-1 libboost-regex1.42.0 libxcb-keysyms1 libclutter-gst-1.0-0 libtar0 libcheese1 libcddb2 libclutter-gtk-1.0-0
  libdvbpsi7 dvdauthor libgee2 libupnp3 libgavl1 libcluttergesture-0.0.2-0 libgtkmm-2.4-1c2a libxcb-randr0 libcv2.1
  bombono-dvd-data libmx-1.0-2 libxml++2.6-2 libcheese-gtk20 scons libboost-filesystem1.42.0 libmlt-data
  libclutter-imcontext-0.1-0 libebml3 libboost-system1.42.0 libmatroska4
Use ‘apt-get autoremove’ to remove them.
The following NEW packages will be installed:
  mplayer
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2957 kB of archives.
After this operation, 5579 kB of additional disk space will be used.

Normally, no more errors when using mplayer.
You should have a look as well at the following bug report :

Debian bug report #616541

mplayer : waitpid(): No child processes

If you encounter the following errors while playing a multimedia file with mplayer :

AO: [pulse] Init failed: Connection terminated
Failed to initialize audio driver ‘pulse’
waitpid(): No child processes
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Internal error
[AO_ALSA] Playback open error: Connection refused
Failed to initialize audio driver ‘alsa’
[AO OSS] audio_setup: Can’t open audio device /dev/dsp: No such file or directory
[AO_ALSA] alsa-lib: pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Then, you have to install the following Debian package to make use of PulseAudio  as the default sound server for all applications like mplayer. Beforehand, most of them were using Alsa as the default audio output.

root@localhost:~#apt-get install pulseaudio-module-x11

To take the modification into account, log out from your current session and log in again. You can be able to play any multimedia files with PulseAudio as the default sound server.

More details about this additional PulseAudio module : pulseaudio-module-x11

alsa-util.c: Could not recover from POLLERR|POLLNVAL|POLLHUP with snd_pcm_prepare()

While resolving an audio input problem within Ekiga, here is a message which occured  in /var/log/syslog on a Ubuntu Lucid (10.04.1 LTS) :

alsa-util.c: Could not recover from POLLERR|POLLNVAL|POLLHUP with snd_pcm_prepare()

I have not found yet where the problem comes from. After searching through ubuntu fora, here is the solution :

sudo apt-get install linux-backports-modules-alsa-lucid-generic linux-backports-modules-alsa-2.6.32-24-generic

In order to make my webcam audio input work, I decided to reboot my computer. The changes I made just before were taken into account.

I hope this help !