Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation method when ffmpeg lacks libx264 dependencies (linu

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

When pushing with the following command:

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'

That is, the libx264 library is missing and needs to be installed:

git clone git://git.videolan.org/x264.git

cd x264

./ configure --enable-static --enable-share --disable-asm

make

sudo make install

Need to recompile installation ffmpeg

When configuring ffmpeg, add x264, such as:

./ configure --enable-gpl --enable-libx264

make clean

make

make install

In this case, when entering ffmpeg, an error may appear:

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

Modify ld.so.conf file

$ sudo vi /etc/ld.so.conf

modified as follows

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

bring into force

$ sudo ldconfig

Add environmental variables for Ffmpeg

vi /etc/profile

Add the following:

export PATH="/usr/local/ffmpeg/bin:$PATH"

Then save and run source /etc/profile

If libx264 is also missing, you need to go to the compiled ffmpeg directory and push it with the following command:

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

###222222

I. Analysis of the cause of the problem

Download xlib264 library

Download x264 Library

git clone git://git.videolan.org/x264.git

Go to the library directory

cd x264

Configuration x264

./ configure --enable-shared --enable-static --disable-asm

compilation execution

make && sudo make install

Third, recompile and install ffmpeg

Need to recompile installation ffmpeg

Download ffmpeg:

Download Method 1:

wget https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2

Unzip: tar jxvf ffmpeg-4.1.tar.bz2

cd ffmpeg-4.1

Download method 2 (this way with git download speed is a bit slow):

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

Configure ffmpeg

./ configure --enable-gpl --enable-libx264

compilation execution

sudo make clean && make && sudo make install

IV. Modify the configuration file

Add the line/etc/ld. so.conf to the/etc/ld.so.conf file, using root of course. Then execute the ldconfig command to make the changes just take effect, and then run ffmpeg transcoding command to try, you can it.

####################33333333333333333333333

When installing ffmpeg, execute

./ configure--enable-libx264 --enable-gpl --disable-yasm --prefix=/usr/local/ffmpeg

make

No mistakes.

But when pushing to the rtmp server

./ ffmpeg -re -i /media/jxs2.rmvb -vcodec libx264 -f flv"rtmp://192.168.5.200:1935/live/a2"

following error occurred

./ ffmpeg: error while loading shared libraries: libx264.so.138: cannot open shared object file: No such file or directory

Solution:

View ld.so.conf file

vi /etc/ld.so.conf

Add/usr/local/x264/lib as follows

include ld.so.conf.d/*.conf

/usr/local/x264/lib

wq exit ld.so.conf file

Execution? ldconfig

Push flow again, problem solved

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report