UP | HOME
Sachin Patil

Sachin Patil

Free Software Developer | GNU Emacs Hacker

[Notes] Fedora 31 Mplayer issue
Published on Feb 17, 2020 by Sachin.

Issue

PulseAudio or ALSA audio drivers are not installed by default on Fedora 31. This results into no sound while playing audio files.

Tests:

 1: mplayer Eddie_Vedder_Guaranteed.mp3
 2: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
 3: 
 4: Playing Eddie_Vedder_Guaranteed.mp3
 5: libavformat version 58.27.102 (internal)
 6: Audio only file format detected.
 7: Load subtitles in ./
 8: ==========================================================================
 9: Requested audio codec family [mpg123] (afm=mpg123) not available.
10: Enable it at compilation.
11: Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
12: libavcodec version 58.51.100 (internal)
13: AUDIO: 44100 Hz, 2 ch, floatle, 320.0 kbit/11.34% (ratio: 40004->352800)
14: Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
15: ==========================================================================
16: [AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
17: DVB card number must be between 1 and 4
18: AO: [null] 44100Hz 2ch floatle (4 bytes per sample)
19: Video: no video
20: Starting playback...
21: A:   4.8 (04.8) of 215.0 (03:35.0)  1.5%

Notice null in the line AO: [null] 44100Hz 2ch floatle (4 bytes per sample), which indicates that the audio output driver is null. Checking what are the available audio output drivers results into following:

1: mplayer -ao help
2: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
3: Available audio output drivers:
4:         oss     OSS/ioctl audio output
5:         mpegpes DVB audio output
6:         v4l2    V4L2 MPEG Audio Decoder output
7:         null    Null audio output
8:         pcm     RAW PCM/WAVE file writer audio output

But none of the available driver works(I purposely excluded pcm because the media file is MP3):

 1: mplayer -ao oss Eddie_Vedder_Guaranteed.mp3
 2: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
 3: 
 4: Playing Eddie_Vedder_Guaranteed.mp3.
 5: libavformat version 58.27.102 (internal)
 6: Audio only file format detected.
 7: Clip info:
 8:  Title: Guaranteed
 9:  Artist: Eddie Vedder
10:  Album: Into The Wild
11:  Year:
12:  Comment:
13:  Genre: Other
14: Load subtitles in ./
15: ==========================================================================
16: Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
17: AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
18: Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
19: ==========================================================================
20: [AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
21: Failed to initialize audio driver 'oss'
22: Could not open/initialize audio device -> no sound.
23: Audio: no sound
24: Video: no video
25: Exiting... (End of file)
26: 
27: 
28: mplayer -ao mpegpes Eddie_Vedder_Guaranteed.mp3
29: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
30: 
31: Playing Eddie_Vedder_Guaranteed.mp3.
32: libavformat version 58.27.102 (internal)
33: Audio only file format detected.
34: Clip info:
35:  Title: Guaranteed
36:  Artist: Eddie Vedder
37:  Album: Into The Wild
38:  Year:
39:  Comment:
40:  Genre: Other
41: Load subtitles in ./
42: ==========================================================================
43: Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
44: AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
45: Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
46: ==========================================================================
47: DVB card number must be between 1 and 4
48: Failed to initialize audio driver 'mpegpes'
49: Could not open/initialize audio device -> no sound.
50: Audio: no sound
51: Video: no video
52: Exiting... (End of file)
53: 
54: 
55: mplayer -ao v4l2 Eddie_Vedder_Guaranteed.mp3
56: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
57: 
58: Playing Eddie_Vedder_Guaranteed.mp3.
59: libavformat version 58.27.102 (internal)
60: Audio only file format detected.
61: Clip info:
62:  Title: Guaranteed
63:  Artist: Eddie Vedder
64:  Album: Into The Wild
65:  Year:
66:  Comment:
67:  Genre: Other
68: Load subtitles in ./
69: ==========================================================================
70: Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
71: AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
72: Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
73: ==========================================================================
74: Failed to initialize audio driver 'v4l2'
75: Could not open/initialize audio device -> no sound.
76: Audio: no sound
77: Video: no video
78: Exiting... (End of file)

Resolution

Installed ALSA & PulseAudio libraries and compile Mplayer again:

 1: sudo dnf install alsa-lib-devel
 2: sudo dnf install pulseaudio-libs-devel
 3: ./configure --prefix=build --bindir="$HOME/bin/" --enable-pulse --enable-alsa
 4: make
 5: make install
 6: 
 7: # for openSUSE 15.4 & Tumbleweed Actually mplayer faild to compile from
 8: # https://mplayerhq.hu/MPlayer/releases/MPlayer-1.5.tar.xz on
 9: # Tumbleweed-20231204 (likely due to ffmpeg) hence clone it from -
10: # svn://svn.mplayerhq.hu/mplayer/trunk
11: sudo zypper install yasm-devel libpulse-devel alsa-devel
12: svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
13: cd mplayer
14: mkdir build
15: ./configure --prefix=build --bindir="$HOME/bin/" --enable-pulse --enable-alsa
16: [ENTER] to download ffmpeg
17: make -j 10
18: make install

Check available audio output drivers:

 1: mplayer -ao help
 2: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
 3: Available audio output drivers:
 4:         oss     OSS/ioctl audio output
 5:         alsa    ALSA-0.9.x-1.x audio output
 6:         pulse   PulseAudio audio output
 7:         mpegpes DVB audio output
 8:         v4l2    V4L2 MPEG Audio Decoder output
 9:         null    Null audio output
10:         pcm     RAW PCM/WAVE file writer audio output

Test:

 1: mplayer Eddie_Vedder_Guaranteed.mp3
 2: MPlayer 1.4-9 (C) 2000-2019 MPlayer Team
 3: 
 4: Playing /home/psachin/Music/Eddie_Vedder_Guaranteed.mp3.
 5: libavformat version 58.27.102 (internal)
 6: Audio only file format detected.
 7: Clip info:
 8:  Title: Guaranteed
 9:  Artist: Eddie Vedder
10:  Album: Into The Wild
11:  Year:
12:  Comment:
13:  Genre: Other
14: Load subtitles in ./
15: ==========================================================================
16: Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
17: AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
18: Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
19: ==========================================================================
20: [AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
21: AO: [alsa] 44100Hz 2ch floatle (4 bytes per sample)
22: Video: no video
23: Starting playback...
24: A:   7.7 (07.6) of 323.0 (05:23.0)  1.2%

I got the sound this time but notice that Mplayer selected the first driver as oss and fallback to alsa later. This can be controlled using -ao flags as shown:

mplayer -ao alsa Eddie_Vedder_Guaranteed.mp3

Or set alsa in ~/.mplayer/config:

1: ao=alsa