Preface
FFmpeg is an open source computer program that can be used to record, convert digital audio and video, and convert them into streams. Use LGPL or GPL license. It provides a complete solution for recording, converting, and streaming audio and video. It contains a very advanced audio/video codec library libavcodec.
Support library installation
sudo apt-get install -y autoconf automake build-essential git libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
apt install libavformat-dev
apt install libavcodec-dev
apt install libswresample-dev
apt install libswscale-dev
apt install libavutil-dev
apt install libsdl1.2-dev
The introduction of the support library is as follows:
libavutil is a library that contains simplified programming functions, including random number generators, data structures, math routines, core multimedia utilities, etc.
libavcodec is a library containing audio/video decoders and encoders.
libavformat is a library that contains libraries for the synthesis and splitting of multimedia container formats.
libavdevice is a library containing input and output devices, used to obtain and present multimedia input/output software frameworks from many common multimedia input/output software frameworks (including Video4Linux, Video4Linux2, VfW, and ALSA).
libavfilter is a library containing media filters.
libswscale is a library that performs highly optimized image scaling and color space/pixel format conversion operations.
libswressample is a library that performs highly optimized audio resampling, rematrixing, and sample format conversion operations.
installation
Download ffmpeg source package
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
./configure --enable-shared --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264 --enable-libx265
If the first configure will prompt the error that yasm is not installed, it is easy to deal with this problem. You can install yasm directly. The specific method is to execute sudo apt-get install yasm in the command line terminal.
make
make install
Increase the dynamic link library of the installation directory:
export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH
View the dynamic library the instruction depends on
ldd ffmpeg
test
ffmpeg –version
Play RTSP streaming media from IPC camera:
ffplay rtsp://192.168.0.123/live/av0