Tag Archives: Unknown encoder ‘libx264’

When ffmpeg is used to push streaming, there may be an error: unknown encoder ‘libx264’

When using the following command to push the stream:

ffmpeg -re -i a.mp4 -vcodec libx264 -acodec aac -f flv rtmp://172.31.102.165:1935/myapp 

The following errors may occur:

Unknown encoder 'libx264'

The libx264 library is missing and needs to be installed.

1. gitclonegit://git.videolan.org/x264.git

2. cdx264

3. ./configure –enable-static –enable-share

4. make

5. sudo make install

Need to recompile and install ffmpeg

1. When configuring ffmpeg, add x264, e.g.

./configure –enable-gpl –enable-libx264

2. make clean

3. make

4. make install

At this point, when entering ffmpeg, an error may occur:.

ffmpeg: error while loading shared libraries: libavdevice.so.57: cannot open shared object file: No such file or directory

*****************************************

Modify the ld.so.conf file

1. $ sudo vi /etc/ld.so.conf

2. Modify the following

include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib ///usr/local/ffmpeg directory is my ffmpeg installation directory, change it according to your installation directory

3. make it work

$ sudo ldconfig

*****************************************

Add environment variables for Ffmpeg
vi /etc/profile
Add:
export PATH=”/usr/local/ffmpeg/bin:$PATH”

Then save and run source /etc/profile

If you are still prompted for missing libx264, you need to go into the compile ffmpeg directory and use the following command to push the stream.

./ffmpeg -re -i a.mp4 -vcodec libx264 -acodec aac -f flv rtmp://172.31.102.165:1935/myapp