Video codec hevc not compatible with flv

本文共有1203个字,关键词:

问题:对摄像机进行推流时报错

解决:摄像头默认参数配置是h264则不会报错。如果出现如下报错,是因为摄像头是h265,FFmpeg是无法直接转成flv的

方法:

ffmpeg -rtsp_transport tcp -i rtsp://user:password@ip:port/Streaming/channels/101  -c:v libx264 -ar 22050 -f flv rtmp://127.0.0.1:1935/live/mystream
ffmpeg -rtsp_transport tcp -i rtsp://user:password@ip:port/Streaming/channels/101 -f flv -s 640x360 -b:v 512k  -b:a 128k -r 25 -ar 22050 rtmp://127.0.0.1:1935/live

这时如果报错:Unknown encoder 'libx264' 则需要重新编译安装ffmpeg

git clone https://gitee.com/xiao2327/x264.git
cd x264
./configure --prefix=/usr/local/x264/ --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared
make
sudo make install
git clone https://gitee.com/mirrors/ffmpeg.git
cd ffmpeg
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-shared --enable-libx264
make clean
make
sudo make install

参考:

https://www.jianshu.com/p/547dca89dd43
https://blog.csdn.net/yuxielea/article/details/103146362
https://www.cnblogs.com/blackhumour2018/p/9400415.html
https://stackoverflow.com/questions/44236871/error-while-opening-encoder-for-output-stream-00
版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。
添加新评论
暂无评论