Ffmpeg can't find libmp3lame "Unknown encoder"

Hi.
I am trying to convert a .aac file mp3, and get the error:

➜  Downloads ffmpeg -ss 0 -i in.aac  -to 00:08:31 -acodec libmp3lame out.mp3
ffmpeg version 6.0.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 7 (SUSE Linux)
  configuration: 
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
[aac @ 0x3214480] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'out1.aac':
  Duration: 00:08:25.13, bitrate: 44 kb/s
  Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 5 kb/s
[aost#0:0 @ 0x3243e40] Unknown encoder 'libmp3lame'

I added pacman repo, and tried to install ffmpeg-6 from it:

➜  Downloads sudo zypper in --allow-vendor-change ffmpeg-6
Refreshing service 'NVIDIA'.
Refreshing service 'openSUSE'.
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: the to be installed ffmpeg-6-6.0.1-150500.4.pm.1.x86_64 conflicts with 'ffmpeg-tools' provided by the installed ffmpeg-4-4.4.4-150500.7.pm.1.x86_64
 Solution 1: deinstallation of ffmpeg-4-4.4.4-150500.7.pm.1.x86_64
 Solution 2: do not install ffmpeg-6-6.0.1-150500.4.pm.1.x86_64

Choose from above solutions by number or cancel [1/2/c/d/?] (c): 1
Resolving dependencies...
Resolving package dependencies...

The following recommended package was automatically selected:
  zeromq-tools

The following 12 NEW packages are going to be installed:
  ffmpeg-6 libavcodec60 libavdevice60 libavfilter9 libavformat60 libavutil58 libpgm-5_2-0 libpostproc57 libswresample4 libswscale7 libzmq5 zeromq-tools

The following package is going to be REMOVED:
  ffmpeg-4

12 new packages to install, 1 to remove.
Overall download size: 9.3 MiB. Already cached: 0 B. After the operation, additional 21.3 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving: libpgm-5_2-0-5.2.122-150400.15.6.x86_64 (repo-oss (15.5))                                                                                        (1/12), 167.6 KiB    
Retrieving: libpgm-5_2-0-5.2.122-150400.15.6.x86_64.rpm ......................................................................................................[done (494.4 KiB/s)]
Retrieving: libzmq5-4.2.3-3.15.4.x86_64 (repo-oss (15.5))                                                                                                    (2/12), 211.5 KiB    
Retrieving: libzmq5-4.2.3-3.15.4.x86_64.rpm ..................................................................................................................[done (480.7 KiB/s)]
Retrieving: zeromq-tools-4.2.3-3.15.4.x86_64 (repo-oss (15.5))                                                                                               (3/12),  31.4 KiB    
Retrieving: zeromq-tools-4.2.3-3.15.4.x86_64.rpm .............................................................................................................[done (264.2 KiB/s)]
Retrieving: libavutil58-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                                 (4/12), 277.0 KiB    
Retrieving: libavutil58-6.0.1-150500.4.pm.1.x86_64.rpm .......................................................................................................[done (239.6 KiB/s)]
Retrieving: libswscale7-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                                 (5/12), 156.4 KiB    
Retrieving: libswscale7-6.0.1-150500.4.pm.1.x86_64.rpm .......................................................................................................[done (156.4 KiB/s)]
Retrieving: libswresample4-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                              (6/12),  57.7 KiB    
Retrieving: libswresample4-6.0.1-150500.4.pm.1.x86_64.rpm .....................................................................................................[done (15.6 KiB/s)]
Retrieving: libpostproc57-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                               (7/12),  41.6 KiB    
Retrieving: libpostproc57-6.0.1-150500.4.pm.1.x86_64.rpm ......................................................................................................[done (15.6 KiB/s)]
Retrieving: libavcodec60-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                                (8/12),   4.3 MiB    
Retrieving: libavcodec60-6.0.1-150500.4.pm.1.x86_64.rpm ......................................................................................................[done (400.0 KiB/s)]
Retrieving: libavformat60-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                               (9/12), 982.0 KiB    
Retrieving: libavformat60-6.0.1-150500.4.pm.1.x86_64.rpm .....................................................................................................[done (927.6 KiB/s)]
Retrieving: libavfilter9-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                               (10/12),   1.3 MiB    
Retrieving: libavfilter9-6.0.1-150500.4.pm.1.x86_64.rpm ........................................................................................................[done (1.2 MiB/s)]
Retrieving: libavdevice60-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                              (11/12),  64.0 KiB    
Retrieving: libavdevice60-6.0.1-150500.4.pm.1.x86_64.rpm ...................................................................................................................[done]
Retrieving: ffmpeg-6-6.0.1-150500.4.pm.1.x86_64 (packman)                                                                                                   (12/12),   1.8 MiB    
Retrieving: ffmpeg-6-6.0.1-150500.4.pm.1.x86_64.rpm ............................................................................................................[done (1.7 MiB/s)]

Checking for file conflicts: ...............................................................................................................................................[done]
( 1/13) Removing ffmpeg-4-4.4.4-150500.7.pm.1.x86_64 .......................................................................................................................[done]
( 2/13) Installing: libpgm-5_2-0-5.2.122-150400.15.6.x86_64 ................................................................................................................[done]
( 3/13) Installing: libzmq5-4.2.3-3.15.4.x86_64 ............................................................................................................................[done]
( 4/13) Installing: zeromq-tools-4.2.3-3.15.4.x86_64 .......................................................................................................................[done]
( 5/13) Installing: libavutil58-6.0.1-150500.4.pm.1.x86_64 .................................................................................................................[done]
( 6/13) Installing: libswscale7-6.0.1-150500.4.pm.1.x86_64 .................................................................................................................[done]
( 7/13) Installing: libswresample4-6.0.1-150500.4.pm.1.x86_64 ..............................................................................................................[done]
( 8/13) Installing: libpostproc57-6.0.1-150500.4.pm.1.x86_64 ...............................................................................................................[done]
( 9/13) Installing: libavcodec60-6.0.1-150500.4.pm.1.x86_64 ................................................................................................................[done]
(10/13) Installing: libavformat60-6.0.1-150500.4.pm.1.x86_64 ...............................................................................................................[done]
(11/13) Installing: libavfilter9-6.0.1-150500.4.pm.1.x86_64 ................................................................................................................[done]
(12/13) Installing: libavdevice60-6.0.1-150500.4.pm.1.x86_64 ...............................................................................................................[done]
(13/13) Installing: ffmpeg-6-6.0.1-150500.4.pm.1.x86_64 ....................................................................................................................[done]
There are running programs which still use files and libraries deleted or updated by recent upgrades. They should be restarted to benefit from the latest updates. Run 'zypper ps -s' to list these programs.

Also, I seem to have libmp3lame installed on my system:

➜  Downloads zypper se libmp3lame
Loading repository data...
Reading installed packages...

S | Name              | Summary                                    | Type
--+-------------------+--------------------------------------------+--------
  | libmp3lame-devel  | Development files for the LAME MP3 encoder | package
i | libmp3lame0       | The LAME MP3 encoder library               | package
  | libmp3lame0-32bit | The LAME MP3 encoder library               | package

The well know procedure is to add the Packman repo and then “to switch vendor to it”.

You apparently just installed some package you think important, but that is not the same. There may be underlying packages that also should be from Packman. So better do the switch first before reporting problems.

You need to enable libmp3lame support in your config as described in the manpages of ffmpeg…

I did:

sudo zypper dup --from pacman

and it installed a bunch of packages.

It looks like libmp3lame support is turned on during the compilation process. I have ffmpeg already installed with zypper

That is correct when the Alias or Name of the Packman repo is pacman (a bit strange tough, without the k ).

But because you report that some packages are installed, I presume you used the correct designation for the Packman repo.

Yeah, and I checked it in the repo list beforehand.

So, why do you think ffmpeg is still not working?

Before one blindly begins to install things, one should first investigate –

 > ffmpeg -codecs | grep -iE 'mp3|lame'
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 7 (SUSE Linux)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --disable-openssl --enable-avresample --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzvbi --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfdk-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
 DEAIL. mp2                  MP2 (MPEG audio layer 2) (decoders: mp2 mp2float ) (encoders: mp2 mp2fixed libtwolame )
 DEAIL. mp3                  MP3 (MPEG audio layer 3) (decoders: mp3float mp3 ) (encoders: libmp3lame )
 D.AIL. mp3adu               ADU (Application Data Unit) MP3 (MPEG audio layer 3) (decoders: mp3adufloat mp3adu )
 D.AIL. mp3on4               MP3onMP4 (decoders: mp3on4float mp3on4 )
 > 

And, check where the codec is installed –

 > LANG=C zypper search libmp3
Loading repository data...
Reading installed packages...

S  | Name                        | Summary                                    | Type
---+-----------------------------+--------------------------------------------+--------
   | libmp3lame-devel            | Development files for the LAME MP3 encoder | package
i+ | libmp3lame0                 | The LAME MP3 encoder library               | package
   | libmp3lame0-32bit           | The LAME MP3 encoder library               | package
   | libmp3lame0-32bit-debuginfo | Debug information for package libmp3lame0  | package
   | libmp3lame0-debuginfo       | Debug information for package libmp3lame0  | package
 > 
 > rpm -ql libmp3lame0
/usr/lib64/libmp3lame.so.0
/usr/lib64/libmp3lame.so.0.0.0
/usr/share/licenses/libmp3lame0
/usr/share/licenses/libmp3lame0/COPYING
/usr/share/licenses/libmp3lame0/LICENSE
 >

And, check the capabilities of the codec –

 > ffmpeg --help encoder=libmp3lame
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 7 (SUSE Linux)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --disable-openssl --enable-avresample --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzvbi --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfdk-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Encoder libmp3lame [libmp3lame MP3 (MPEG audio layer 3)]:
    General capabilities: delay small 
    Threading capabilities: none
    Supported sample rates: 44100 48000 32000 22050 24000 16000 11025 12000 8000
    Supported sample formats: s32p fltp s16p
    Supported channel layouts: mono stereo
libmp3lame encoder AVOptions:
  -reservoir         <boolean>    E...A...... use bit reservoir (default true)
  -joint_stereo      <boolean>    E...A...... use joint stereo (default true)
  -abr               <boolean>    E...A...... use ABR (default false)

 >

You may have to verify that, your installation is correct –

 # rpm --verify --verbose libmp3lame0
.........    /usr/lib64/libmp3lame.so.0
.........    /usr/lib64/libmp3lame.so.0.0.0
.........    /usr/share/licenses/libmp3lame0
.........  l /usr/share/licenses/libmp3lame0/COPYING
.........  l /usr/share/licenses/libmp3lame0/LICENSE
 # 
 # LANG=C zypper verify
Loading repository data...
Reading installed packages...
Dependencies of all installed packages are satisfied.
 #

It seems like I don’t have libmp3lame encoder support in ffmpeg.

➜  ~ ffmpeg -codecs | grep -iE 'mp3|lame'                                   
ffmpeg version 6.0.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 7 (SUSE Linux)
  configuration: 
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
 D.AIL. mp3                  MP3 (MPEG audio layer 3) (decoders: mp3float mp3 )
 D.AIL. mp3adu               ADU (Application Data Unit) MP3 (MPEG audio layer 3) (decoders: mp3adufloat mp3adu )
 D.AIL. mp3on4               MP3onMP4 (decoders: mp3on4float mp3on4 

I wonder why is that?

What?
From what to what?
AAC is a proprietary format. Install needed aac packages from Packman before using it.
You can use Handbrake to convert.

Do you have the “libmp3lame0” package installed?
Are the following files installed on your system?

 > ls -l /usr/lib64/libmp3lame*
lrwxrwxrwx 1 root root     19 20. Sep 12:14 /usr/lib64/libmp3lame.so.0 -> libmp3lame.so.0.0.0
-rwxr-xr-x 1 root root 306040 20. Sep 12:14 /usr/lib64/libmp3lame.so.0.0.0
 > 

.aac to .mp3
I did install all the essential codecs from Pacman from here. It’s a standard procedure, I should have all codecs installed by now.

Handbrake is essentially just a GUI for ffmpeg, so if ffmpeg doesn’t do the job, Handbrake won’t either.

Yes

~ ls -l /usr/lib64/libmp3lame*
lrwxrwxrwx 1 root root     19 Sep 20 13:14 /usr/lib64/libmp3lame.so.0 -> libmp3lame.so.0.0.0
-rwxr-xr-x 1 root root 306040 Sep 20 13:14 /usr/lib64/libmp3lame.so.0.0.0

I seem to have found the solution.

I found ffmpeg binary in /usr/local/bin, that was the version of the program which was malfunctioning and me trying to run it. I don’t remember how it had gotten there. In my ‘$PATH’ variable /usr/local/bin precedes /usr/bin (which contains the good version) and that’s the reason why the ffmpeg from the wrong folder was chosen.

I deleted /usr/local/bin/ffmpeg and now it works like a charm.
Thanks to everybody volunteering to help and keeping the community vibrant.

You could have executed the following to investigate why it was placed there –

 > LANG=C rpm --query --whatprovides /usr/local/bin/ffmpeg
error: file /usr/local/bin/ffmpeg: No such file or directory
 > 
 > LANG=C rpm --query --whatprovides /usr/local/bin
filesystem-15.0-11.8.1.x86_64
 > 
 > LANG=C rpm --query --whatprovides /usr/local/bin/empty 
file /usr/local/bin/empty is not owned by any package
 > 

And, PATH is normally as follows:

 > echo $PATH
/home/???/bin:/usr/local/bin:/usr/bin:/bin
 >

But, at the end of the day, you possibly executed a script which dropped an FFmpeg executable in the normally empty ‘/usr/local/bin/’ system directory …