FFmpeg is installed offline on the Centos server (including required dependencies) and implements pulling rtsp streams and pushing to rtmp servers

Scenes

Use FFmpeg on Windows to push rtsp video stream to RTMP streaming server (EasyCVR streaming server):

Using FFmpeg on Windows to push rtsp video stream to RTMP streaming server (EasyCVR streaming server)_rtsp transfer-CSDN blog

The above describes the application example of ffmpeg on Windows. If it is on a centos server and the server cannot access the external network, it needs to be installed offline.

For FFmpeg and the required dependencies, please refer to the following process.

Note:

Blog:
Domineering hooligan temperament_C#, architecture road, SpringBoot-CSDN blog

accomplish

1. First install the dependency nasm required by ffmpeg

Install nasm offline on centos

Download nasm package

https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz

Upload to the server, for example, create a new nasm directory under /etc and upload it to this directory.

Unzip

tar -xvf nasm-2.14.tar.gz

Enter the decompressed directory and execute

./configure

then compile

make && make install

After successful compilation, no error is reported and can be verified.

nasm -version

2. Centos offline installation of yasm

Download the software package and upload it to the server, here it is in the /etc/yasm directory

http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

Unzip the package

tar zxvf yasm-1.3.0.tar.gz

Enter the decompressed directory and perform configuration and compilation

./configure

make && make install

You can verify whether the installation is successful by following

yasm --version

3. Install x264 offline on centos

Download the installation package

x264, the best H.264/AVC encoder - VideoLAN

After downloading and uploading to the server, the .tar.bz2 file is located in the /etc/x264 directory.

To decompress the .tar.bz2 file on centos, you can use the following command

tar -jxvf x264-master.tar.bz2

Unzip and enter the directory to perform configuration and compilation.

./configure --enable-shared --enable-static

make && make install

This can be verified as follows

x264 --version

4. Check whether gcc and pkg have been installed on the server

gcc installation verification

gcc --version

pkg installation verification

pkg-config --version

The above two dependent servers are already available and will not be installed anymore.

5. Compile and install FFmpeg offline on Centos

Download software installation package

http://ffmpeg.org/releases/ffmpeg-6.0.tar.xz

Or visit the official website to choose any version

Download FFmpeg

Upload the installation package to the server and decompress it

tar -xvf ffmpeg-6.0.tar.xz

Move the decompressed directory to the specified directory

mv ffmpeg-6.0/ /usr/local/ffmpeg/

Move here to /usr/local/ffmpeg, enter this directory and execute

./configure --enable-gpl --enable-libx264 --enable-static --disable-shared --enable-encoder=libx264 --extra-libs=-ldl

If no error is reported, the compilation is successful.

then compile

make && make install

The compilation time here is long, and it can be passed after the compilation is successful.

ffmpeg

verify

6. Trap: Prompt during configuration

ERROR: x264 not found using pkg-config

This is because the default location is used when x264 is installed, and pkg-config will search for .pc files in the specified path, so just move the .pc file to the specified directory.

First find the location of x264

find / -name 'libx264.so.164'

Then go to the found /usr/local/lib/pkgconfig/x264.pc and move it to the /usr/share/pkgconfig directory

sudo mv /usr/local/lib/pkgconfig/x264.pc /usr/share/pkgconfig

Then modify the ld.so.conf configuration file

vim /etc/ld.so.conf

Add the last line as follows

/usr/local/lib/

Load changes

ldconfig

If you execute the above command to configure ffmpeg, no error will be reported.

7. Use ffmpeg on centos to pull Hikvision rtsp video stream and convert and push the stream to rtmp server

The first choice is to set up the rtmp server with port 11935 and execute the following instructions.

ffmpeg -i "rtsp://admin:123456@摄像头ip:554/h264/ch01/main/av_stream" -vcodec libx264 -acodec aac -f flv rtmp://流媒体服务器ip:11935/myapp/badao

Pull and push flows are successful.

UseUse the preview page verification that comes with streaming media

Streaming media construction reference is as follows

Monibucav4 (open source streaming media server) builds an rtmp server on Windows and implements pulling rtsp video streams and converting flv playback:

Monibucav4 (open source streaming media server) builds an rtmp server on Windows and implements pulling rtsp video streams and converting flv playback_monibuca builds streaming media services-CSDN blog

Guess you like

Origin blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/134788616