7

I’m having an issue with FFmpeg after configuring it exactly to their own wiki’s instructions where I’m receiving the following:

ffmpeg -stats -i uncompressed.video.mkv -codec x264 -preset veryslow -pass 2 -an compressed.video.mkv
[Removed for readability]
Unknown encoder 'x264'

Attempting the same with libx264 instead of x264 results in a similar error:

Invalid encoder type 'libx264'

So I ran:

~$ ffmpeg -codecs | grep x264

And got:

ffmpeg version 2.6.git Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=/home/hindenpeter/ffmpeg_build --extra-cflags="-I/home/hindenpeter/ffmpeg_build/include --extra-ldflags=-L/home/hindenpeter/ffmpeg_build/lib --bindir=/home/hindenpeter/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 29.100 / 56. 29.100
  libavformat    56. 26.101 / 56. 26.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 13.101 /  5. 13.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (encoders: libx264 libx264rgb )

As far as I can tell, ffmpeg was configured with --enable-libx264, and a simple ls of ~/bin reveals that I did in fact install it from source as outlined in the guide I linked above.

So can anyone help me figure out exactly what I did wrong, and how I can fix it?

Giacomo1968
  • 58,727

3 Answers3

6

Try this:

ffmpeg -stats -i uncompressed.video.mkv -vcodec libx264 -preset veryslow -pass 2 -an compressed.video.mk

or this:

ffmpeg -stats -i uncompressed.video.mkv -codec:v libx264 -preset veryslow -pass 2 -an compressed.video.mk
Brian
  • 471
1

Rather than configuring with --enable-libx264, you will have to configure with --enable-gpl

SJP
  • 11
0

In a WSL ubuntu 24.04, anaconda3 conda 24.5.0 environment, this error is due to an outdated version of FFmpeg. To resolve this, please upgrade to 7.0.2 using the following commands:

conda uninstall ffmpeg  
conda install -c conda-forge ffmpeg  

The -c option specifies the channel name from which Conda retrieves packages. If you want to install a package from a different channel, use the command conda install -c channel_name package_name.

Finally, don't forget to check the version again with ffmpeg -version to confirm that the installation was successful.