零编译,两行命令,搭建全链路直播和RTC环境

启动SRS:

# For macOS
docker run --rm -p 1935:1935 -p 1985:1985 -p 8080:8080 \
    --env CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2}') -p 8000:8000/udp \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:v4.0.76

# Or CentOS
docker run --rm -p 1935:1935 -p 1985:1985 -p 8080:8080 \
    --env CANDIDATE=$(ifconfig eth0|grep 'inet '|awk '{print $2}') -p 8000:8000/udp \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:v4.0.76

FFmpeg推流:

docker run --rm --network=host registry.cn-hangzhou.aliyuncs.com/ossrs/srs:encoder \
  ffmpeg -re -i ./doc/source.200kbps.768x320.flv -c copy \
      -f flv -y rtmp://localhost/live/livestream

也可以使用H5推WebRTC流:webrtc://localhost/live/livestream

播放:

  • VLC(RTMP): rtmp://localhost/live/livestream
  • H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
  • H5(HLS): http://localhost:8080/live/livestream.m3u8
  • H5(WebRTC): webrtc://localhost/live/livestream

嗯,你得有个Docker。

你可能感兴趣的:(零编译,两行命令,搭建全链路直播和RTC环境)