Search code examples
ffmpeg

Unknown encoder 'libx265' on Ubuntu 18.04


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?


Solution

  • 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.