How to install libmp3lame for ffmpeg

12

6

I already have ffMpeg running on my test server. I would want to convert all possible audio files to mp3.

I get the error 'codec not found'.

here's what i typed:

/var/www/i/uploads$ sudo /usr/local/bin/ffmpeg -i a.mp3 -f mp3 con.mp3
FFmpeg version SVN-r25385, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  7 2010 11:56:13 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --disable-yasm
  libavutil     50.32. 2 / 50.32. 2
  libavcore      0. 9. 1 /  0. 9. 1
  libavcodec    52.92. 0 / 52.92. 0
  libavformat   52.80. 0 / 52.80. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.48. 0 /  1.48. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[mp3 @ 0x123e470] max_analyze_duration reached
Input #0, mp3, from 'a.mp3':
  Metadata:
    TCON            : Classic Rock
    TRCK            : 16/16
    TLAN            : eng
    TPE1            : Scorpions
    TIT2            : Rock You Like A Hurricane
    Rip date        : 2008-06-17
    TYER            : 2008
    TDAT            : 0000
    Source          : CD
    TSSE            : LAME 3.97 -V2 --vbr-new
    Ripping tool    : EAC
    Release type    : Undifined
    TPUB            : Universal Music Canada
    TIT1            : Barney's Get Psyched Mix
    TALB            : Barney's Get Psyched Mix
  Duration: 00:04:12.52, start: 0.000000, bitrate: 208 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 208 kb/s
File 'con.mp3' already exists. Overwrite ? [y/N] y
Output #0, mp3, to 'con.mp3':
    Stream #0.0: Audio: [0][0][0][0] / 0x0000, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Encoder (codec id 86017) not found for output stream #0.0

How can i install lame mp3 codec for ffmpeg?

Hrishikesh Choudhari

Posted 2010-10-07T07:26:26.097

Reputation: 223

Answers

5

First, I see this is on an Ubuntu machine, so let me first suggest you go to the Ubuntu wiki ffmpeg page.

Basically, what you want to do is compile ffmpeg from source so it includes libmp3lame. They tell you how to make your ffmpeg with more option on this page. When you commence the build with ./configure, you need to add --enable-libmp3lame

SleighBoy

Posted 2010-10-07T07:26:26.097

Reputation: 2 066

23

The link in the selected answer is now obsolete. On Kubuntu 11.04 (and above), do:

sudo apt-get install ffmpeg libavcodec-extra-53

augustin

Posted 2010-10-07T07:26:26.097

Reputation: 415

1if libavcodec-extra-53 doesn't work, try sudo install libavcodec-extra-* – mido – 2015-03-08T16:22:16.363

I can't install that package: "E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages." Installing anything else works fine. – Calmarius – 2015-04-16T06:06:40.077

3Worked on Ubuntu 12.04 as well. – reuf – 2012-11-21T13:46:50.847

Also works for Ubuntu 13.10 saucy! – Brad – 2013-11-05T02:17:04.670

6

The solution may be to compile ffmpeg manually:

The post suggests to compile x264 and ffmpeg yourself. But use x264 from Ubuntu and compile just ffmpeg is enough. So, here are the steps. Start by removing ffmpeg and making sure x264 is properly installed.

apt-get remove ffmpeg    
apt-get update
apt-get install libx264-106 libx264-dev x264 

Then, login as root, download, compile and install ffmpeg:

su -
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
make    
make install

Diogo Melo

Posted 2010-10-07T07:26:26.097

Reputation: 61

3

For coding in mp3, in gentoo I have added the "mp3" USE flag, it's add the lame support.

USE="mp3" emerge ffmpeg

Toni Gamez

Posted 2010-10-07T07:26:26.097

Reputation: 131

0

To install the right codecs using Aptitude:

sudo apt-get install libmp3lame-dev

Depending on the distro you are using and build of FFmpeg an older solution may be the one which works.

If FFmpeg has been installed using source then it will have to be reconfigured, built and installed with the respective switches for the codecs you want.

./configure  --enable-libmp3lame
make
make install

TRex22

Posted 2010-10-07T07:26:26.097

Reputation: 1

In Ubuntu libav-tools is a virtual/transitional package that points to ffmpeg, so you can just use ffmpeg unless your distro version is old. Installing libmp3lame-dev does nothing for the ffmpeg package from the repo; it does not enable MP3 encoding. – llogan – 2016-07-01T16:47:56.003

Well I installed that stuff first with no luck, then I built ffmpeg with the extra configure flag and what do you know I can now encode mp3s. The libav-tools I installed did not give me ffmpeg. I had to manually build and install it – TRex22 – 2016-07-02T17:52:17.290

I think I installed libav-tools after building and installing ffmpeg so my bad. – TRex22 – 2016-07-02T18:03:07.490

-1

I forgot the exact procedure, but I used avconv to convert my MP4 to FLV, and then use ffmpeg to convert the FLV to SWF. It worked.

Yan King Yin

Posted 2010-10-07T07:26:26.097

Reputation: 131

That's inefficient. – llogan – 2015-12-11T18:13:12.540

but at least I don't need to compile ffmpeg ;) – Yan King Yin – 2015-12-12T21:54:49.983

What does this have to do with the question, which is conversion TO MP3? – Ben Voigt – 2016-06-20T20:07:21.573

It's just one way to bypass the libmp3lame codec... I was searching for how to install it, and found this question. – Yan King Yin – 2016-06-20T23:31:33.800