Paul Maunders | Web log
Economics, Business, Telecoms, Tech and Gadgets

Encoding mp3 audio with ffmpeg on Ubuntu Hardy

April 15th, 2008 by Paul Maunders

If you already have ffmpeg installed (without mp3 support), then firstly uninstall it.

MP3 support isn’t included with ffmpeg in the default Ubuntu repositories so to get it you have to enable the Medibuntu repos (assuming this is legal in your area).

sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O - | sudo apt-key add - && sudo apt-get update

Then you can install ffmpeg and the libmp3lame codec (part of the libavcodec package)

sudo apt-get install ffmpeg
sudo apt-get install libavcodec1d

You can verify the dependencies of ffmpeg with ldd

paul@paul:~/Videos$ ldd /usr/bin/ffmpeg
	linux-gate.so.1 =>  (0xb7f07000)
	libavformat.so.1d => /usr/lib/libavformat.so.1d (0xb7e72000)
	libavcodec.so.1d => /usr/lib/libavcodec.so.1d (0xb7997000)
	libavutil.so.1d => /usr/lib/libavutil.so.1d (0xb798c000)
	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7967000)
	libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb794f000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7800000)
	libz.so.1 => /usr/lib/libz.so.1 (0xb77eb000)
	libogg.so.0 => /usr/lib/libogg.so.0 (0xb77e6000)
	libdc1394_control.so.13 => /usr/lib/libdc1394_control.so.13 (0xb77d6000)
	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb77d2000)
	liba52-0.7.4.so => /usr/lib/liba52-0.7.4.so (0xb77c7000)
	libgsm.so.1 => /usr/lib/libgsm.so.1 (0xb77ba000)
	libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0xb7725000)
	libtheora.so.0 => /usr/lib/libtheora.so.0 (0xb76db000)
	libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb76b3000)
	libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0xb75ba000)
	libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0xb74a2000)
	libx264.so.57 => /usr/lib/libx264.so.57 (0xb7417000)
	libfaac.so.0 => /usr/lib/libfaac.so.0 (0xb7406000)
	/lib/ld-linux.so.2 (0xb7f08000)
	libraw1394.so.8 => /usr/lib/libraw1394.so.8 (0xb73ff000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb7318000)
	libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb7316000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb72fe000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb72fa000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb72f5000)

It should then let you encode videos with mp3 audio…

ffmpeg -i jonathan-davis-news24-2008-01-22.avi -f flv -s 400s220 -acodec mp3 -ar 44100 jd.flv

Posted in linux, ubuntu

3 Responses

  1. mykel

    libavcodec1d was what i was missing - installing it allowed me to output mp3 audio on transcoded videos :) thankyou for this. most of the other how-tos involve recompiling ffmpeg and that seemed like total overkill.

  2. JorjK

    ubuntu 8.04 NOT WORK !!!

    Output #0, flv, to ‘3_0.flv’:
    Stream #0.0: Video: flv, yuv420p, 180×144, q=2-31, 200 kb/s, 25.00 fps(c)
    Stream #0.1: Audio: 0×0000, 44100 Hz, stereo, 64 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    Unsupported codec for output stream #0.1

  3. Mac

    It works in Ubuntu 8.04, but you have to force-install the Medibuntu versions of both ffmpeg and libavcodec1d - I used synaptic to achieve this.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.