网站编辑器做段落空格,优秀的国风网页设计欣赏,pdf文件打印乱码,网站优化与推广这个是使用metrtc的库为ffmpeg添加webrtc传输协议#xff0c;目前国内还有一个这样的开源项目#xff0c;是杨成立大佬#xff0c;大师兄他们在做#xff0c;不过wili页面维护的不好#xff0c;新手不知道如何使用#xff0c;我专门对它做过介绍#xff0c;另一篇博文目前国内还有一个这样的开源项目是杨成立大佬大师兄他们在做不过wili页面维护的不好新手不知道如何使用我专门对它做过介绍另一篇博文ubuntu22.10 ffmpeg-webrtc推拉流srs环境搭建 后者目前还不支持whep(应该在开发中)因此推荐使用metartc的库。 首选它有三个第三方库先编译这三个库。
版本commit 681b58754e9dd4bcfe79388ea73782705124c65b master 1.metartc6 2.srtp 3.ssl和crypto 4.编译ffmpeg 5.推流命令 WHIP 6.拉流命令 WHEP 7.测试 7.1配置srs 7.1推流 7.3拉流 笔者用的是ubuntu22.04默认gcc/g是11 在编译srtp时报错多重定义其实是编译器版本过高需要切换版本。
sudo apt-get install gcc-9
sudo apt-get install g-9
sudo ln -sf /usr/bin/gcc-9 /usr/bin/gcc
sudo ln -sf /usr/bin/g-9 /usr/bin/g1.metartc6这里有webrtc的传输协议。
cd FFmpeg-n4.3.3/metartc6/metartc6
cd libmetartccore6
mkdir build
cd build
./cmake_x64.sh //x86_64
cp ./libmetartccore6.a ../../2.srtp
./configure
make -j20
cp libsrt2.a ../3.openssl
./config
make -j20
cp libcrypto2.a libssl2.a ../4.编译ffmpeg注意下面路径改为自己的路径
./configure --enable-libx264 --enable-gpl --extra-libs-L/home/yqw/temp/ffmpeg-webrtc/FFmpeg-n4.3.3/metartc6 -lmetartccore6 -lpthread -lsrtp2 -lssl -lcrypto -ldl
make -j20
sudo make install5.推流命令 WHIP
ffmpeg ......-acodec opus -strict -2 -ar 48000 -f webrtc url
srs sample: whip url http://192.168.0.105:1985/rtc/v1/whip/?applivestreamlivestreamffmpeg ......-acodec opus -strict -2 -ar 48000 -f webrtc http://192.168.0.105:1985/rtc/v1/whip/?applivestreamlivestreamffmpeg ......-acodec opus -strict -2 -ar 48000 -f webrtc webrtc://192.168.0.105:1985/rtc/v1/whip/?applivestreamlivestream./ffmpeg -re -i /path/test.mp4 -vcodec libx264 -acodec opus -strict -2 -ar 48000 -f webrtc http://192.168.0.105:1985/rtc/v1/whip/?applivestreamlivestream6.拉流命令 WHEP
ffplay webrtc://whep_url
srs sample: whep url http://192.168.0.105:1985/rtc/v1/whip-play/?applivestreamlivestreamffplay webrtc://192.168.0.105:1985/rtc/v1/whip-play/?applivestreamlivestream7.测试 7.1拉取srs代码 srs版本要求SRS version 5.0.153 or higher, or 6.0.43 or higher。
https://github.com/ossrs/srs编译srs后运行
./objs/srs -c conf/https.rtc.conf7.2推流
ffmpeg -re -i /home/yqw/t/juren-30s.mp4 -vcodec libx264 -acodec opus -strict -2 -ar 48000 -f webrtc http://192.168.100.77:1985/rtc/v1/whip/?applivestreamlivestream如果不要视频如下
ffmpeg -re -i /home/yqw/t/west.mp4 -vn -acodec opus -strict -2 -ar 48000 -f webrtc http://192.168.100.77:1985/rtc/v1/whip/?applivestreamlivestream7.3拉流
ffplay webrtc://192.168.100.77:1985/rtc/v1/whip-play/?applivestreamlivestream附录 libmetartccore2 来自于metaRTC-2.0.120.zip编译 对于2.0 commit 3b7034bbf3a9fbe5682733f0adf11763c75edf28 ./ffmpeg -re -i /home/yqw/t/juren-30s.mp4 -vcodec libx264 -acodec opus -strict -2 -ar 48000 -f webrtc “webrtc://192.168.100.77:1985/live/livestream”
./ffplay webrtc://192.168.100.77:1985/live/livestream