# Unable to play AC3 audio in VLC and MPlayer2



## nickednamed (Jul 4, 2013)

After an upgrade of multimedia/mplayer2 I found myself unable to hear any audio in files which use AC3 audio, for example in the following file:

`# ffprobe1 ~/downloads/ghibli/castle.in.the.sky.avi`


```
ffprobe version 1.2.1 Copyright (c) 2007-2013 the FFmpeg developers
  built on Jul  4 2013 14:31:03 with gcc 4.2.1 (GCC) 20070831 patched [FreeBSD]
  configuration: --prefix=/usr/local --mandir=/usr/local/man --incdir=/usr/local/include/ffmpeg1 --libdir=/usr/local/lib/ffmpeg1 --shlibdir=/usr/local/lib/ffmpeg1 --datadir=/usr/local/share/ffmpeg1 --build-suffix=1 --progs-suffix=1 --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-pthreads --enable-memalign-hack --disable-libstagefright-h264 --disable-libutvideo --disable-libsoxr --cc=cc --extra-cflags='-msse -I/usr/local/include/vorbis -I/usr/local/include' --extra-ldflags='-L/usr/local/lib ' --extra-libs=-pthread --disable-debug --disable-libaacplus --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libass --disable-libcdio --disable-libcelt --disable-libfaac --disable-libfdk-aac --enable-fontconfig --enable-libfreetype --enable-frei0r --disable-gnutls --disable-libgsm --enable-iconv --disable-libmp3lame --disable-libbluray --disable-libv4l2 --disable-libmodplug --disable-openal --enable-libopencv --disable-libopenjpeg --disa  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpeg4 @ 0x2a0ce420] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from '/home/user/downloads/ghibli/castle.in.the.sky.avi':
  Metadata:
    album           : CASTLE_IN_THE_SKY
    title           : CASTLE_IN_THE_SKY.Title2.Angle1.DVDRip
    encoder         : Lavf52.78.4
  Duration: 02:04:34.68, start: 0.000000, bitrate: 1871 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DX50 / 0x30355844), yuv420p, 720x410 [SAR 1:1 DAR 72:41], 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: [B]Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s[/B]
```

Playing the above file, gives me the following error message:

`# mplayer ~/downloads/ghibli/castle.in.the.sky.avi`


```
MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team

Playing /home/user/downloads/ghibli/castle.in.the.sky.avi.
Detected file format: AVI (Audio Video Interleaved) (libavformat)
[mpeg4 @ 0x28b3b300]Invalid and inefficient vfw-avi packed B frames detected
[lavf] stream 0: video (mpeg4), -vid 0
[B][lavf] stream 1: audio (ac3), -aid 0[/B]
Clip info:
 album: CASTLE_IN_THE_SKY
 title: CASTLE_IN_THE_SKY.Title2.Angle1.DVDRip
 encoder: Lavf52.78.4
Load subtitles in /home/user/downloads/ghibli/
[ass] auto-open
Selected video codec: MPEG-4 part 2 [libavcodec]
[ac3 @ 0x28b3b300]frame sync error
[B]The player has been compiled without libavresample support,
which is needed with this libavcodec decoder version.
Compile with libavresample enabled to make audio decoding work![/B]
ad_ffmpeg: initial decode failed
Audio decoder init failed for codecs.conf entry "ffac3".
[B]Requested audio codec family [a52] (afm=liba52) not available.
Enable it at compilation.[/B]
hwac3: switched to AC3, 448000 bps, 48000 Hz

Selected audio codec: AC3 through S/PDIF [hwac3]
AUDIO: 48000 Hz, 2 ch, ac3be, 448.0 kbit/29.17% (ratio: 56000->192000)
[AO OSS] Can't set audio device /dev/dsp to ac3le output, trying s16le...
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
[format] Sample format big-endian AC3 not yet supported 
[libaf] Reinitialization did not work, audio filter 'format' returned error code -2
[libaf] Unable to setup filter system can not meet sound-card demands, please send bugreport. 
Couldn't find matching filter/ao format!
[B]Audio: no sound[/B]
Starting playback...
[mpeg4 @ 0x28b3b300]Invalid and inefficient vfw-avi packed B frames detected
VIDEO:  720x410  23.976 fps    0.0 kbps ( 0.0 kB/s)
VO: [xv] 720x410 => 720x410 Planar YV12 
V:   2.5   0/  0  2%  2%  0.0% 0 0 

Exiting... (Quit)
```

When I play the same files with multimedia/vlc, I get a horrible hissing sound, even with "liba52" enabled upon compilation. Other videos and audio tracks such as AAC, MP3 and FLAC seem to work fine in both players, only AC3 seems to be a problem. All files work fine in multimedia/mplayer which doesn't require multimedia/ffmpeg1.

I can't say I understand all this, but I gather from the mplayer2 error messages that I need to compile multimedia/mplayer2 or multimedia/ffmpeg1 with the "libavresample" and "liba52" options enabled. But I can't find any compilation options in the configuration interface (see below).

Many sources on the internet also suggest compiling multimedia/ffmpeg1 with the "--enable-libavresample" option enabled, see HERE, HERE, and HERE.

I've checked the compile time options, for multimedia/mplayer2, multimedia/ffmpeg1 but can't find the relevant options (libavresample or liba52):

`# cd /usr/ports/multimedia/mplayer2 && make showconfig`


```
===> The following configuration options are available for [B]mplayer2-2.0.20130126_1[/B]:
     ASS=on: Enable ASS/SSA subtitle rendering
     CACA=off: libcaca graphics library support
     DEBUG=off: Install debug symbols
     DV=off: Quasar DV video codec support (libdv)
     GIF=off: GIF image format support
     IPV6=on: IPv6 protocol support
     JACK=off: JACK audio server support
     JOYSTICK=off: Enable joystick support
     LADSPA=off: LADSPA audio plugins support
     LIBBLURAY=off: Blu-ray discs support via libbluray
     LIBCDIO=off: Enable libcdio support
     LIRC=off: Enable lirc support
     MAD=off: MAD MP3 audio decoder support
     OPENGL=off: OpenGL support
     PORTAUDIO=off: PortAudio library support
     PULSE=off: Enable PulseAudio support
     REALPLAYER=off: Enable realplayer plugin
     RTC=off: Enable kernel realtime clock timing
     SDL=off: Simple Direct Media Layer support
     SMB=off: SMB protocol support
     SPEEX=off: Speex audio format support
     THEORA=off: Enable ogg theora video support
     V4L=off: Enable Video4Linux TV support
     VDPAU=off: VDPAU (GPU video acceleration) support
     WIN32=on: Enable win32 codec set on the IA32 arch
     X11=on: X11 (graphics) support
     XINERAMA=off: X11 Xinerama extension support
===> Use 'make config' to modify these settings
```

`# cd /usr/ports/multimedia/ffmpeg1 && make showconfig`


```
====> The following configuration options are available for [B]ffmpeg1-1.2.1_1:[/B]
     AACPLUS=off: AAC support via libaacplus
     ALSA=off: ALSA audio architecture support
     AMR_NB=off: AMR Narrow Band audio support (opencore)
     AMR_WB=off: AMR Wide Band audio support (opencore)
     ASS=off: Subtitles rendering via libass
     CDIO=off: Audio CD grabbing with libcdio
     CELT=off: CELT audio codec support
     DEBUG=off: Install debug symbols
     FAAC=off: FAAC AAC encoder support
     FDK_AAC=off: AAC audio encoding via Fraunhofer FDK
     FFSERVER=on: Build and install ffserver
     FONTCONFIG=on: X11 font configuration support
     FREETYPE=on: TrueType font rendering support
     FREI0R=on: Frei0r video plugins support
     GNUTLS=on: SSL/TLS support via GnuTLS
     GSM=off: GSM codec support
     ICONV=on: Encoding conversion support via iconv
     LAME=off: LAME MP3 audio encoder support
     LIBBLURAY=off: Blu-ray discs support via libbluray
     LIBV4L=off: Video for Linux support
     MODPLUG=off: Mod support via libmodplug
     OPENAL=off: OpenAL 1.1 capture support
     OPENCV=on: OpenCV support
     OPENJPEG=off: Enhanced JPEG graphics support
     OPENSSL=off: SSL/TLS support via OpenSSL
     OPTIMIZED_CFLAGS=off: Use extra compiler optimizations
     OPUS=off: Opus decoding with libopus
     PULSEAUDIO=off: PulseAudio sound server support
     RTMP=off: RTMP protocol support via librtmp
     SCHROEDINGER=on: Dirac codec support via libschroedinger
     SDL=off: Simple Direct Media Layer support
     SPEEX=off: Speex audio format support
     THEORA=on: Ogg Theora video codec support
     VAAPI=off: VAAPI (GPU video acceleration) support
     VDPAU=off: VDPAU (GPU video acceleration) support
     VORBIS=on: Ogg Vorbis audio codec support
     VO_AACENC=off: AAC audio encoding via vo-aacenc
     VO_AMRWBENC=off: AMR Wide Band encoding via vo-amrwbenc
     VPX=on: VP8 video codec support
     X11GRAB=off: Enable x11 grabbing
     X264=on: H.264 video codec support via x264
     XVID=on: Xvid MPEG-4 video codec support
===> Use 'make config' to modify these settings
```

I've also searched both the mplayer2 and ffmpeg1 "Makefiles" but I haven't found any reference to "libavresample", although I did find the following in the mplayer2 Makefile:

```
CONFIGURE_ARGS= --cc=${CC} \
          --extra-cflags='-I${LOCALBASE}/include/ffmpeg1 \
          -I${LOCALBASE}/include/portaudio2' \
          --extra-ldflags='-L${LOCALBASE}/lib/ffmpeg1 \
          -L${LOCALBASE}/lib/portaudio2' \
          --mandir=${PREFIX}/man \
          --disable-alsa \
[B]          --disable-liba52 \[/B]
          --disable-directfb \
          --disable-faad \
          --disable-mng \
          --disable-libdca \
          --disable-xvid \
          --disable-mpg123 \
          --disable-musepack
  MAKE_ARGS+= BINDIR=${PREFIX}/bin \
          CONFDIR=${PREFIX}/etc/mplayer
```

Can I simply remove the above entry from the multimedia/mplayer2 Makefile?

Can I manually edit the multimedia/ffmpeg1 make file?


----------



## nb (Jul 4, 2013)

I have _a_ similar problem since yesterday, after _a_ KDE upgrade from 4.10.3 to 4.10.4 (about 160 packages). Old mplayer2 binary, configuration files etc. are without changes.


----------



## nickednamed (Jul 5, 2013)

It seems there there was an update on the 4th of July 2013 which solved this issue (with mplayer2 at least), see HERE and HERE. However, multimedia/vlc is still having problems with AC3. Is it a multimedia/ffmpeg1 problem? (see original post).


----------



## nb (Jul 6, 2013)

After KDE _having been_ upgrade_d from_ 4.10.4 _to_ 4.10.5  (if that make_s_ any sense) and mplayer2 _from_ 2.0.20130126_1 _to_  2.0.20130126_2, all works OK*.*


----------

