Problem: ffmpeg/vlc can no longer encode using MPEG AAC Audio after upgrade from Ubuntu 7.10 to 8.04

From WhyNotWiki
Jump to: navigation, search

Contents

Summary

2008-05-18:

After I upgraded from Ubuntu 7.10 to 8.04, I had trouble encoding with acodec=mp4a.

Here is what I tried and the errors that resulted:

> vlc mms://stream.vctv.tv/Archives/04-19-08.wmv :sout=#transcode\{vcodec=mp4v,vb=1024,scale=1,acodec=mp4a,ab=192,channels=2\}:duplicate{dst=std{access=file,mux=ts,dst="/home/tyler/Videos/Village Church/2008-04-19.mp4"\}\}
...
VLC media player 0.8.6e Janus
[00000312] access_mms access: selecting stream[0x1] audio (41 kb/s)
[00000312] access_mms access: ignoring stream[0x2] audio (22 kb/s)
[00000312] access_mms access: ignoring stream[0x3] audio (14 kb/s)
[00000312] access_mms access: selecting stream[0x4] video (296 kb/s)
[00000312] access_mms access: ignoring stream[0x5] video (128 kb/s)
[00000312] access_mms access: ignoring stream[0x6] video (49 kb/s)
[00000312] access_mms access: connection successful
[00000368] ffmpeg encoder error: cannot find encoder MPEG AAC Audio
[00000301] stream_out_transcode private error: cannot find encoder ((null))
[00000301] stream_out_transcode private error: cannot create audio chain
[00000317] main packetizer error: cannot create packetizer output (wma2)

Despite those error messages, it successfully recorded the .mp4 file. However, the resulting video had no audio, so it was worthless!

I eventually got it working again, but it required uninstalling ffmpeg and libavcodec and reinstalling them from Medibuntu.

http://ubuntuforums.org/showthread.php?p=4991963#post4991963. Retrieved on 2007-05-11 11:18.

The way I got aac encoding working again in ffmpeg was first to add these lines to the top of /etc/apt/sources.list:

deb http://packages.medibuntu.org/ hardy free non-free
deb-src http://packages.medibuntu.org/ hardy free non-free

and then:

sudo apt-get update && sudo apt-get install medibuntu-keyring
sudo apt-get remove ffmpeg
sudo apt-get install ffmpeg
sudo apt-get install libavcodec1d


What I tried / researched

Googled for:

  • cannot find encoder MPEG AAC Audio hardy
  • ffmpeg "cannot find encoder MPEG AAC Audio" (ubuntu OR debian)
  • ffmpeg "cannot find encoder MPEG AAC Audio" "cannot find encoder"
  • encode aac hardy
  • medibuntu aac
  • medibuntu ffmpeg mp3

Not surprisingly, many people have run into this error before and had ideas on how to fix. Somewhat to my surprise, though, it looks this problem did not start appearing when Hardy was released; rather, people have been running into it as far back as 2006-08-25 [1].


> sudo apt-get install faac faad
...
Get:1 http://us.archive.ubuntu.com hardy/multiverse libmp4v2-0 1:1.6dfsg-0.2ubuntu1 [324kB]
Get:2 http://us.archive.ubuntu.com hardy/multiverse faac 1.26-0.1ubuntu1 [40.2kB]
Get:3 http://us.archive.ubuntu.com hardy/universe faad 2.6.1-2 [29.5kB]

acodec=mp4a still does the same thing, as does acodec=aac.

Actually, changing it to acodec=aac might have resulted in the ffmpeg encoder error: cannot find encoder MPEG AAC Audio line disappearing but still these lines remaining and no audio being recorded:

[00000301] stream_out_transcode private error: cannot find encoder ((null))
[00000301] stream_out_transcode private error: cannot create audio chain

http://thinliquidfilm.org/forum/viewtopic.php?t=12. Retrieved on 2007-05-11 11:18.

Do you have aac support compiled into ffmpeg?


bezdomny@sony-ar11m:~$ ffmpeg -formats | grep aac
FFmpeg version SVN-r8129, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-libdts --enable-libfaac --enable-libfaad --enable-libfaadbin
--enable-xvid --enable-libmp3lame --enable-gpl
libavutil version: 49.3.0
libavcodec version: 51.34.0
libavformat version: 51.10.0
built on Mar 12 2007 14:48:19, gcc: 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
D aac ADTS AAC
ffmpeg -formats | grep aac

I didn't save the output from this command, but I believe it was:

 D  aac             ADTS AAC

http://ubuntu-utah.ubuntuforums.org/showthread.php?p=4383833. Retrieved on 2007-05-11 11:18.

IF YOU HAVE FFMPEG WITH NO SUPPORT FOR AAC : you will get:

D aac ADTS AAC

here you can't see E [encoder] so until you have ffmpeg with all encoder support, you will not able to encode.


> ldd /usr/bin/ffmpeg

I didn't save the output from this command, but I don't think it listed libmp3lame.so.0 or libfaac.so.0 (as it does now that I got it working).

I read that maybe I need libavcodec to be installed.

sudo apt-get install libavcodec

could not find any matching packages. I eventually found a reference [2] to libavcodec0d and tried this:

sudo apt-get install libavcodec0d

but that said I was already at the latest version.

About this time, I also tried encoding with acodec=mp3, but that didn't work either, to my great surprise!

[00000349] ffmpeg encoder error: cannot find encoder MPEG Audio layer 1/2/3

Clearly, upgrading to Hardy caused some of my packages to be "upgraded" to the latest official Ubuntu releases, which don't include some of the icky proprietary codecs that so many of use every day. So I guess I need to revert those packages to a less encumbered state...


Medibuntu to the rescue!

http://www.mepislovers.org/forums/showthread.php?page=2. Retrieved on 2007-05-11 11:18.

If you add/enable the debian-multimedia repo, you can get a fully enabled ffmpeg from there.

http://www.alexandergrundner.com/2008/01/01/how-to-get-full-multimedia-support-in-ubuntu-and-unlock-ffmpeg/. Retrieved on 2007-05-11 11:18.

Acquire an Unlocked, Fully Enabled Version of FFmpeg: Grabbing FFmpeg from Mediabuntu is critical (see steps above) if you want to encode videos to H.264/AAC (ipod/quicktime), DivX/Xvid/MP3, OGG Theora, etc. Note: FFmpeg is available in the standard Ubuntu repository but it’s very much hobbled and you’ll be disappointed when certain video editing apps and transcoding programs don’t work as expected.


Added these lines to the top of /etc/apt/sources.list:

deb http://packages.medibuntu.org/ hardy free non-free
deb-src http://packages.medibuntu.org/ hardy free non-free
sudo apt-get update && sudo apt-get install medibuntu-keyring
sudo apt-get remove ffmpeg
sudo apt-get install ffmpeg
> apt-cache search libavcodec
libavcodec-dev - development files for libavcodec - Medibuntu package
libavcodec1d - ffmpeg codec library - Medibuntu package
mencoder - MPlayer's Movie Encoder - Medibuntu package
libdlna-dev - development files for libdlna
libdlna0 - DLNA codec library
libavcodec0d - ffmpeg codec library - Medibuntu package
sudo apt-get install libavcodec1d

It was after doing this that encoding AAC and MP3 started working again.


Now that it works: Extra details about the libraries/packages I have installed...

> ffmpeg -version
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-libmp3lame --enable-libfaadbin --enable-libfaad --enable-libfaac --enable-xvid --enable-x264 --enable-liba52 --enable-amr_nb --enable-amr_wb --enable-shared --prefix=/usr
  libavutil version: 1d.49.3.0
  libavcodec version: 1d.51.38.0
  libavformat version: 1d.51.10.0
  built on Apr  3 2008 18:39:35, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
ffmpeg      SVN-rUNKNOWN
libavutil   3212032
libavcodec  3352064
libavformat 3344896


> ffmpeg -formats 2>&1 | grep aac
  configuration: -... --enable-libfaac ...
 D  aac             ADTS AAC
 DEA    aac
 D A    mpeg4aac

> ffmpeg -formats 2>&1 | grep mp3
  configuration: ... --enable-libmp3lame...
 DE mp3             MPEG audio layer 3
 DEA    mp3
 D A    mp3adu
 D A    mp3on4

http://ubuntu-utah.ubuntuforums.org/showthread.php?p=4383833. Retrieved on 2007-05-11 11:18.

IF YOU HAVE FFMPEG COMPILED FROM SOURCE you will get: as you can see here it has D [decoder] (aac) and it has E [encoder]. The name of the codec for compiled ffmpeg is libfaac.

 D  aac             ADTS AAC
  EA    libfaac
 D A    mpeg4aac

so you need to use:

ffmpeg -i INPUT -ab 128k -acodec libfaac OUTPUT


IF YOU HAVE FFMPEG FROM MEDIBUNTU REPO you will get:

D  aac             ADTS AAC
 DEA    aac
 D A    mpeg4aac

so you need to use:

ffmpeg -i INPUT -ab 128k -acodec aac OUTPUT

instead (it has E = aac so the name you must use is aac)



> apt-cache policy ffmpeg
ffmpeg:
  Installed: 3:0.cvs20070307-5ubuntu7+medibuntu1
  Candidate: 3:0.cvs20070307-5ubuntu7+medibuntu1
  Version table:
 *** 3:0.cvs20070307-5ubuntu7+medibuntu1 0
        500 http://packages.medibuntu.org hardy/free Packages
        100 /var/lib/dpkg/status
     3:0.cvs20070307-5ubuntu7 0
        500 http://us.archive.ubuntu.com hardy/universe Packages

> apt-cache policy libavcodec1d
libavcodec1d:
  Installed: 3:0.cvs20070307-5ubuntu7+medibuntu1
  Candidate: 3:0.cvs20070307-5ubuntu7+medibuntu1
  Version table:
 *** 3:0.cvs20070307-5ubuntu7+medibuntu1 0
        500 http://packages.medibuntu.org hardy/free Packages
        100 /var/lib/dpkg/status
     3:0.cvs20070307-5ubuntu7 0
        500 http://us.archive.ubuntu.com hardy/main Packages


> ldd /usr/bin/ffmpeg
        linux-vdso.so.1 =>  (0x00007fff573ff000)
        libavformat.so.1d => /usr/lib/libavformat.so.1d (0x00007f414ee19000)
        libavcodec.so.1d => /usr/lib/libavcodec.so.1d (0x00007f414e74c000)
        libavutil.so.1d => /usr/lib/libavutil.so.1d (0x00007f414e543000)
        libm.so.6 => /lib/libm.so.6 (0x00007f414e2c2000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f414e0a6000)
        libc.so.6 => /lib/libc.so.6 (0x00007f414dd44000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f414db2d000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f414d928000)
        libdc1394_control.so.13 => /usr/lib/libdc1394_control.so.13 (0x00007f414d718000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f414d514000)
        liba52-0.7.4.so => /usr/lib/liba52-0.7.4.so (0x00007f414d309000)
        libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007f414d0fc000)
        libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x00007f414ce64000)  <--- *
        libtheora.so.0 => /usr/lib/libtheora.so.0 (0x00007f414cc20000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f414c9f4000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007f414c61c000)
        libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0x00007f414c32b000)
        libx264.so.57 => /usr/lib/libx264.so.57 (0x00007f414c0ab000)
        libfaac.so.0 => /usr/lib/libfaac.so.0 (0x00007f414be9a000)  <--- *
        /lib64/ld-linux-x86-64.so.2 (0x00007f414f0a0000)
        libraw1394.so.8 => /usr/lib/libraw1394.so.8 (0x00007f414bc94000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f414b991000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0x00007f414b790000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f414b575000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f414b373000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f414b16e000)



What I should have done differently (= learn from my mistakes)

Install the medibuntu.org repository first thing. Install everything from there that looks tasty (after uninstalling the currently installed version).

Other links

https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/6366

https://bugs.launchpad.net/medibuntu/+bug/225060

http://po-ru.com/diary/bleeding-edge-ffmpeg-on-ubuntu-feisty/ (how to compile/build ffmpeg such that the features you want are included)

Ads
Personal tools