Skip to content

Instantly share code, notes, and snippets.

@johan149
Last active November 8, 2023 23:02
Show Gist options
  • Save johan149/8eba975312814db14155ba9e56010946 to your computer and use it in GitHub Desktop.
Save johan149/8eba975312814db14155ba9e56010946 to your computer and use it in GitHub Desktop.
Install SRS dev docker
# run this on the clean CLI
# bash <(curl -sL https://gist.githubusercontent.com/johan149/8eba975312814db14155ba9e56010946/raw/d0b6eeaa14291d4395c059890eff04bff385f678/install_dev_srs.sh)
# install docker
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common aria2
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt -y install docker-ce
sudo chmod 666 /var/run/docker.sock
docker ps
# install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
docker stop `docker ps -qa` && docker rm `docker ps -qa` && docker rmi -f `docker images -qa && docker volume rm $(docker volume ls -qf)` && docker network rm `docker network ls -q`
# delete any srs folder
rm -r ~/srs
# git clone SRS develop branch
cd ~
#git clone https://gitee.com/ossrs/srs.git srs && cd srs/trunk &&
git clone https://github.com/ossrs/srs.git
#git clone --branch bugfix/fix-demux-codec-pps-error https://github.com/chundonglinlin/srs.git
#git remote set-url origin https://github.com/ossrs/srs.git && git pull
# download my conf file
aria2c -s 16 --continue=true --max-concurrent-downloads=16 --max-connection-per-server=16 --min-split-size=100M "https://gist.githubusercontent.com/johan149/8dcdef41b7aa9431894cf34010f1df1d/raw/7e972ce170bb5fa8a5c43538159993eedb58984f/srt_rtc_hevc.conf" -d ~/srs/trunk/conf
# download test video stream 4k60p
#@aria2c -s 16 --continue=true --max-concurrent-downloads=16 --max-connection-per-server=16 --min-split-size=100M "https://mirrors.dotsrc.org/blender/blender-demo/movies/BBB/bbb_sunflower_2160p_30fps_normal.mp4" -d ~/srs/trunk/doc
# build docker
cd ~/srs/trunk &&
docker run -it --rm -v `pwd`:/srs -w /srs ossrs/srs:dev \
bash -c "./configure --h265=on --srt=on && make"
# start docker SRS
cd ~/srs/trunk &&
CID=$(docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 -p 8085:8085 -p 10080:10080/udp\
--env CANDIDATE=$(wget -qO- ifconfig.me | xargs echo) -p 8000:8000/udp \
-it -d --rm -v `pwd`:/srs -w /srs ossrs/srs:ubuntu20 \
./objs/srs -c conf/srt_rtc_hevc.conf)
# check logs
docker logs $CID -f
# run ffmpeg localhost test stream
# docker run --rm -it -d --add-host=host.docker.internal:host-gateway -d ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/source.flv -c copy -f flv rtmp://host.docker.internal/live/livestream
# run ffmpeg localhost test stream
# docker run --rm -it -d --add-host=host.docker.internal:host-gateway -d ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/bbb_sunflower_2160p_30fps_normal.mp4 -c copy -f flv rtmp://host.docker.internal/live/livestream2
# stop docker
# docker stop $CID
# SRS dashboard
# https://origin.meetmo.io/console/en_index.html#/streams?port=443&schema=https&host=origin.meetmo.io
# streams API
# https://origin.meetmo.io/api/v1/streams/
# clients API
# https://origin.meetmo.io/api/v1/clients/
# Snapshot thumbnail preview
# https://origin.meetmo.io/live/livestream-006.png
# SRT
# publish:
# srt://origin.meetmo.io:10080?streamid=#!::r=live/srt,m=publish
# play:
# srt://origin.meetmo.io:10080?streamid=#!::r=live/srt,m=request
#RTMP
# publish
# rtmp://origin.meetmo.io:1935/live/rtmpStream
# to play FLV
# https://origin.meetmo.io/live/rtmpStream.flv
# to play TS
# https://origin.meetmo.io/live/rtmpStream.ts
# to play HLS
# https://origin.meetmo.io/live/rtmpStream.m3u8
# WebRTC
# publish:
# https://origin.meetmo.io/players/rtc_publisher.html
# webrtc://origin.meetmo.io/live/WebRTC
# play:
# https://origin.meetmo.io/players/rtc_player.html
# webrtc://origin.meetmo.io/live/WebRTC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment