Construction of webrtc protocol test environment for streaming media analysis

1. ffmpeg supports the webrtc protocol, which is implemented using Yang Dashen's MetaRTC library. ffmpeg implements webrtc push-pull stream to srs service. In this chapter, we build a webrtc test environment.

1. Compile the metartc library function.

MetaRTC is a webRTC library built for embedded/Internet of Things, providing webRTC capabilities for the third-generation Internet Metaverse. MetaRTC implements the webrtc protocol and provides both pure C and C++ versions of the interface.

metartc5编译
git clone https://github.com/metartc/metaRTC.git
修改include/yang_config.h

对接srs
#define Yang_HaveDatachannel 1
将Yang_HaveDatachannel设为0

ssl库
metaRTC5 linux版本默认ssl库为mbedtls
使用openssl 修改#define Yang_Using_Openssl 0
将Yang_Using_Openssl设为1

编译metaRTC5
cd libmetartccore5
./cmake_x64.sh
或者
./cmake_android.sh

 Compile the mbedtls3 library

解压metartc5/mbedtls-3.2.1.7z
./cmake_x64.sh
或者
./cmake_android.sh

 Compile the srtp library

srtp编译
解压metartc5/libsrtp-2.4.2.7z
./cmake_x64.sh
或者
./cmake_android.sh
编译后可重命名libsrtp2_mbed.a

  compile ffmpeg

lsrtp2 库支持mbed加密 支持ffmpeg编译
将编译的libmetartccore5.a和其他第三方库放入metartc5目录里
./configure --enable-libx264 --enable-gpl --extra-libs='-L/home/youliang/code/media/ffmpeg-rtc/FFmpeg-n4.3.3/metartc5 -lmetartccore5 -lpthread -lspeexdsp -lsrtp2 -lmbedtls -lmbedx509 -lmbedcrypto -ldl'
make -j8

openssl库ffmpeg编译
./configure --enable-libx264 --enable-gpl  --enable-libsrt  --extra-libs='-L/home/youliang/code/media/ffmpeg-rtc/FFmpeg-n4.3.3/metartc5 -lmetartccore5 -lpthread -lspeexdsp -lsrtp2 -lssl -lcrypto -ldl'
make -j8

2. Streaming command:


ffmpeg -i BD.1080P.mkv -acodec opus -strict -2 -ar 48000 -f webrtc webrtc://192.168.3.98/live/livestream

pull command 

ffplay webrtc://192.168.3.98/live/livestream

Guess you like

Origin blog.csdn.net/u012794472/article/details/126827566