RTSP转RTMP推流
RTSP转RTMP推流
一、编译安装FFMPEG
- 下载安装libfdk_aac
wget https://downloads.sourceforge.net/opencore-amr/fdk-aac-2.0.1.tar.gz
tar -zxvf fdk-aac-2.0.1.tar.gz
cd fdk-aac-2.0.1
./configure --prefix=/usr --disable-static
make & make install
- 常见错误
# 报错:缺少libx264
git clone https://code.videolan.org/videolan/x264.git
cd x264
git checkout stable
./configure --disable-asm --enable-shared --enable-static --prefix=/usr/local
make & make install
# 报错:缺少libx265
wget http://download.videolan.org/videolan/x265/x265_3.2.tar.gz
tar -zxvf x265_3.2.tar.gz
cd x265_3.2
mkdir bld && cd bld && cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../source && make && make install
# 报错:ERROR: x265 not found using pkg-config
# 执行
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
ldconfig
二、样例
nohup ffmpeg -rtsp_transport tcp -i rtsp://admin:muyuanfoods.com@123.138.227.46:5599/Streaming/Channels/1901 -s 360x240 -vcodec:v libx264 -map 0 -r 30 -f hls -hls_list_size 1 -hls_wrap 10 -hls_time 10 -hls_wrap 15 /tmp/hs/stream/muyuan/1901/out.m3u8 > hls.log &
nohup ffmpeg -rtsp_transport tcp -i rtsp://admin:muyuanfoods.com@123.138.227.46:5599/Streaming/Channels/201 -s 360x240 -vcodec:v libx264 -map 0 -r 30 -f hls -hls_list_size 1 -hls_wrap 10 -hls_time 10 -hls_wrap 15 /tmp/hs/stream/muyuan/201/out.m3u8 > hls.log &
附ffmpeg源码包:
ffmpeg-4.4.tar.gzRTSP转RTMP推流
https://www.lingyepro.com/archives/411