[Solved] ffmpeg error reporting: subprocess. Calledprocesserror: Command ‘ffmpeg, unknown encoder: “libx264″“

0x00 problem description

Today we are compressing the video into different quality in the lab, so we need to use the FFmpeg tool (we have to say that this tool is really powerful), but when we install it, we call out the following mistakes when we call it in Python script.

subprocess.CalledProcessError: Command 'ffmpeg -i /data/xiangtao/dataset/celeb-DF/0_Celeb-real/id0_0000.mp4 -vf select="eq(pict_type\,I)" -vsync vfr -qscale:v 2 -f image2 /data/xiangtao/dataset/tmp/VA-MLP/celeb-DF/11-12/id0_0000/%02d.jpg' returned non-zero exit status 127.

The reason is that libx264 encoder is not installed,

Unknown encoder: "libx264"

0x01 solution

Baidu has been trying several ways for a long time, most of the solutions have to be reinstalled FFmpeg, then install the libx264 Library in the process of installation, try it all wrong, and later discovered that there is a package in the python environment, then ffmpeg will uninstall the python script, which calls for the use of this package. Based on this idea, I reinstalled the ffmpeg package and solved it perfectly!!!

0x02 specific steps

    1. if ffmpeg is available in the current Python environment, uninstall it first
pip uninstall ffmpeg
conda uninstall ffmpeg


pip install ffmpeg
conda install ffmpeg

0x03 some gossip

Read More: