Unknown encoder 'libx264'
Asked Answered
P

3

79

I installed ffmpeg 0.8.9 on ubuntu11 by

./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libx264

When I run it

ffmpeg -y -i test.mp4 -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -vcodec libx264 -b 250k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 250k -maxrate 250k -bufsize 250k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 a.ts

It said

Unknown encoder 'libx264'

(Note: the same error could occour with avconv)

How can I fix this? Thanks!

Perreira answered 19/3, 2012 at 3:41 Comment(2)
Is x264 installed on the system (should be as easy as "apt-get install libx264-dev" on Ubuntu)? Does "ffmpeg -codecs" have a libx264 line?Midwifery
What is the precise underlying problem, though? I have files in /opt/lib "libx264.so" "libx264.so." "libx264.a". The exact problem must be that these files need to be found and are not (eg opt/lib isn't in LD_LIBRARY_PATH)Micheal
O
107

I am using Ubuntu 11.04, and I also came across this error - Unknown encoder 'libx264'. Installing the package libavcodec-extra-53 resolved the problem.

In Ubuntu 14.04 LTS the package that is needed is called libavcodec-extra-54 (and libav-tools)

Ornithosis answered 5/4, 2012 at 11:20 Comment(7)
Maybe I have not been keeping up with updates, but on my Ubuntu 11.04 I had to install libavcodec-extra-52, 53 didn't exist.Bradbradan
This one worked for me, to get simplescreenrecorder encoding in x264.Chronoscope
Still necessary (and working) in Ubuntu 13.10 (saucy).Anson
Why does installing this package remove a huge number of installed encoders? Is this part of that irritating dispute between whoever writes ffmpeg and whoever write avconv?Frugivorous
Meanwhile it's libavcodec-ffmpeg-extra56 (and simply libavcodec-extra)Parse
For Ubuntu 18.04: sudo apt-get install libavcodec-extra57 libavformat57 libavutil55. askubuntu.com/a/852608/775359Puritanism
Check also which ffmpeg you are using, especially if you are working with anaconda. You should use /usr/bin/ffmpegMaccaboy
E
45

start by installing these libraries

sudo apt-get install libfdk-aac-dev libass-dev libopus-dev  \
libtheora-dev libvorbis-dev libvpx-dev libssl-dev

For Ubuntu 20.04 issue

sudo apt-get install nasm

and hop over this manual nasm install ... yet as of Ubuntu 17.04 sudo apt-get install nasm does not supply a new enough nasm so install that manually

get source for nasm at http://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D download the latest then

cd ~/src/nasm-2.13.02  #  update to release you just downloaded
./configure
make -j $(nproc)
sudo make install

Then for x264 :

git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-static --enable-shared
make -j $(nproc)
sudo make install

For mp3 get LAME (libmp3lame)

sudo apt-get install libmp3lame-dev

or install manually from http://lame.sourceforge.net/ version v3.100, then give it the normal

cd lame-3.100/
./configure
make -j $(nproc)
sudo make install

Finally download ffmpeg source and do install :

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg

./configure  --enable-gpl   --enable-libass   --enable-libfdk-aac   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libtheora   --enable-libvorbis   --enable-libvpx   --enable-libx264   --enable-nonfree --enable-shared --enable-openssl   

make -j $(nproc)
sudo make install

I feel your pain, but this works - still valid on Ubuntu 22.04

Extinguish answered 27/2, 2013 at 6:52 Comment(6)
I tried this, but the configure in the last step gives the following error: "libfaac not found"Keffiyeh
+1 - This worked for me on Mac OS Mavericks (10.9.4). I was fighting to try and install libx264 so it can be integrated into FFMPEG for about 2 hours. Thank you so much!Hooghly
--enable-libfaac does not work for me. Not sure if it is the same, but I used this param --enable-libfdk-aac, previously installing apt install libfdk-aac-devPseudohermaphroditism
@Pseudohermaphroditism cool now updated ... above is current for Ubuntu 17.04Extinguish
error in the x264 part step make -j8: filters/video/resize.c: In function ‘pick_closest_supported_csp’: filters/video/resize.c:215:30: error: ‘AVComponentDescriptor {aka const struct AVComponentDescriptor}’ has no member named ‘depth’ if( pix_desc->comp[i].depth > 8 ) ^ Makefile:277: recipe for target 'filters/video/resize.o' failed make: *** [filters/video/resize.o] Error 1Auxiliary
This solution worked for me on Ubuntu 18.04, but after the last step I needed to also do sudo apt-get upgrade ffmpegPteridophyte
P
18

I got this error with Ubuntu 18 while using OpenAI Gym. You need correct versions of ffmpeg and x264 encoder. To get them, I used following and it worked:

conda install x264=='1!152.20180717' ffmpeg=4.0.2 -c conda-forge
Prothesis answered 16/10, 2019 at 20:37 Comment(1)
this one worked for me. I did try to install ffmpeg from snap and snap does enable libx264 but once I installed ffmpeg-python, the conda automatically installed ffmpeg again, the auto-installed ffmpeg has the libx264 disabled. So installing ffmpeg with conda for this specific version is the one and ONLY working solution for me.Yesterday

© 2022 - 2024 — McMap. All rights reserved.