在阿里云的服务器上一直没有实现出来,还是在公司的服务器上才行,也比较奇怪,先记录下。
1.任务

可以发现,这里使用的是rtc2rtmp.conf的配置文件
webrtc是默认⽀持的(–rtc=on),使⽤默认的rtc配置(conf/rtc2rtmp.conf)就可以运行。
2.rtc2rtmp.conf的配置
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 1985;
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
candidate 192.168.1.101;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
唯一需要修改的就是candidate,在官网上有多种方式,在这里使用直接写死的方式,本来这里就是本机的地址,没有关系。
参考官网说明:https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
3.使用rtmp推流
使用srs自带的流
ffmpeg -re -i source.200kbps.768x320.flv -vcodec copy -acodec copy -f flv -y rtmp://192.168.1.101:1935/live/livestream
流的目录:

4.运行起来,在srs自带的播放器中进行测试
目前没有找到好的播放器来验证功能是否可用,就使用自带的好了。
从这里进行进入:
http://192.168.1.103:8080/

posted on
浙公网安备 33010602011771号