Search code examples
ffmpeglibx264

Unable to use FFMPEG to transcode video


I am getting the below error while transcoding videos automatically using nzbtomedia (https://github.com/clinton-hall/nzbToMedia/).

Transcoder returned:b"Unknown encoder 'libx264'\n" has failed

How do I install this encoder?

Raspbain (Raspberry PI)

Additional Info:

FFMPEG Version

ffmpeg version N-96192-g2ff687c17f Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: 
libavutil      56. 38.100 / 56. 38.100
libavcodec     58. 65.100 / 58. 65.100
libavformat    58. 35.101 / 58. 35.101
libavdevice    58.  9.101 / 58.  9.101
libavfilter     7. 69.101 /  7. 69.101
libswscale      5.  6.100 /  5.  6.100
libswresample   3.  6.100 /  3.  6.100

ffmpeg -encoders | grep 264

ffmpeg version N-96192-g2ff687c17f Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: 
  libavutil      56. 38.100 / 56. 38.100
  libavcodec     58. 65.100 / 58. 65.100
  libavformat    58. 35.101 / 58. 35.101
  libavdevice    58.  9.101 / 58.  9.101
  libavfilter     7. 69.101 /  7. 69.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)

Solution

  • It appears you followed this ancient wiki guide that had you compile ffmpeg without libx264 enabled.

    I'm guessing you are using Raspbian Buster which the official repository currently offers FFmpeg 4.1.4 with libx264 enabled. So uninstall the ffmpeg you compiled:

    cd ~/ffmpeg
    sudo make uninstall
    

    Then install ffmpeg from the repository:

    sudo apt install ffmpeg
    

    Now when you run ffmpeg it should show --enable-libx264 in the output.

    You may also see --enable-omx --enable-omx-rpi --enable-mmal which will allow hardware decoding/encoding of:

    • H.264 encoding (-c:v h264_omx) & decoding (-c:v h264_mmal)
    • MPEG-4 Part 2 video encoding (-c:v mpeg4_omx) & decoding (-c:v mpeg4_mmal)
    • MPEG-2 video decoding (-c:v mpeg2_mmal)
    • VC-1 decoding (-c:v vc1_mmal)