I'm running the following command on my Ubuntu 20.04
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 -f mp4 output.mp4
I get the statement: Unknown encoder 'libx265'
I installed the encoder with the command sudo apt-get install libx265-dev libnuma-dev but I still get the same message. Do you know what I am doing wrong or how to get ffmpeg to work with this encoder?
I was getting this error on Ubuntu 22.04. For me, a ffmpeg installation within my conda environment was creating the problem.
I was running ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4 from a conda environment that also had ffmpeg installation which I came to know by running whereis ffmpeg. As a reference, I am pasting below the whereis command output
ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /home/chuchu/anaconda3/envs/py382/bin/ffmpeg /usr/share/man/man1/ffmpeg.1.gz
As you can see along with system-wide installations of ffmpeg, I also have a conda installation. Then I tried running ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4 command after changing to another conda environment which does not contain conda installation of ffmpeg and it worked perfectly!
I solved it by using
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev
as posted on the website - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
I understand I was missing an update/some package installations must have changed my previous configuration.
Edit: I ended up getting the same error on a different system. I turned out to have multiple installations of ffmpeg in different locations and the one I was using did not have the required builds. I solved this by removing all installations of ffmpeg (using whereis) and then used the build linked by Gyan in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With