赞
踩
- wget https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
- tar -zxvf pkg-config-0.29.2.tar.gz
- cd pkg-config-0.29.2/
- ./configure
- make
- make check
- make install
-
- pkg-config --version #验证
-
-
-
- unzip x264-stable.zip (https://www.videolan.org/developers/x264.html)
- cd x264-stable
- ./configure --enable-shared --enable-static --disable-asm # 未指定目录,动态库在/usr/local/lib。可添加prefix指定
- make -j8 & make install -j8
-
- x264 -V #验证
-
-
-
- git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
- cd nv-codec-headers
- make -j8 & make install -j8
-
-
-
- tar -zxvf x265_3.2.1.tar.gz (https://www.videolan.org/developers/x265.html)
- cd x265_3.2.1
- cd build/linux
- ./make-Makefiles.bash #若报./make-Makefiles.bash: 行 3: ccmake: 未找到命令 但目录生生成有Makefile文件,继续执行
- make -j8 && make install -j8
-
- x265 -V #验证。动态库找不到问题,ldd x265 查询库位置:拷贝 或 软链接 或 ldconfig 配置
-
-
-
- wget https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz
- tar -zxvf lame-3.100.tar.gz
- cd lame-3.100
- ./configure
- make -j8 && make install -j8
-
- lame -V #验证
-
-
-
- #wget http://www.ffmpeg.org/releases/ffmpeg-5.0.2.tar.gz
- #tar -zxvf ffmpeg-5.0.2.tar.gz
- cd ffmpeg-5.0.2/
- export PATH="$HOME/bin:$PATH"
- export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/:/usr/lib64/pkgconfig/"
- ./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-static --enable-debug --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-gpl --disable-optimizations --disable-stripping --enable-version3 --disable-x86asm --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib #-I,-L是上面的动态库和头文件
- make -j8 && make install -j8
- ln -s /usr/local/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg
-
- ffmpeg -version
-
- ffmpeg configure --help #使用格式
- ffmpeg configure -encoders #编码 grep H.
- ffmpeg configure -decoders #解码
- ffmpeg configure -protocols #协议
###############################
ffmpeg安装目录在/usr/local/ffmpeg
ffmpeg: error while loading shared libraries: libavdevice.so.59: cannot open shared object file: No such file or directory
find动态库位置,export LD_LIBRARY_PATH 或 修改 /etc/ld.so.conf,ldconfig 生效
export LD_LIBRARY_PATH=/usr/local/lib/:/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH
测试:
将视频进行h264编码,并推rtsp流
ffmpeg -re -ss 00:00:00 -i h265.mp4 -rtsp_transport tcp -c:v libx264 -an -b:v 995k -f rtsp rtsp://localhost/139367/e6
将视频进行h265编码,并推rtsp流
ffmpeg -re -ss 00:00:00 -i h264.mp4 -rtsp_transport tcp -c:v libx265 -an -b:v 995k -f rtsp rtsp://localhost/139366/e6
h265编码视频转码h264
ffmpeg -i h265.mp4 -c:v libx264 -an -b:v 995k -t 10 test.mp4
参考:ffmpeg 支持用h265编码的rtmp_ffmpeg h265 rtmp_howe8888的博客-CSDN博客
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。