Edward-Wu/srt-live-server

some documentation on running srt send/receive with or without srt-live-server

boxerab opened this issue · 1 comments

If this is useful, can be added to the existing documentation:

Building ffmpeg

https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

cd ~/ffmpeg_sources &&
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 &&
tar xjvf ffmpeg-snapshot.tar.bz2 &&
cd ffmpeg &&
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure
--prefix="$HOME/ffmpeg_build"
--pkg-config-flags="--static"
--extra-cflags="-I$HOME/ffmpeg_build/include"
--extra-ldflags="-L$HOME/ffmpeg_build/lib"
--extra-libs="-lpthread -lm"
--ld="g++"
--bindir="$HOME/bin"
--enable-gpl
--enable-gnutls
--enable-libass
--enable-libfdk-aac
--enable-libfreetype
--enable-libmp3lame
--enable-libopus
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libx265
--enable-libsrt
--enable-nonfree &&
PATH="$HOME/bin:$PATH" make &&
make install &&
hash -r

Pipelines:

(BigBuckBunny_512kb.ts is encoded as mpeg2video + mp2 audio )

Here is a conversion command line to convert to mpeg2video + mp2:

ffmpeg -i input.mp4
-c:v mpeg2video -qscale:v 2
-c:a mp2 -b:a 192k
output.ts

A) command line sender => command line receiver

Sender:

ffmpeg -re -i ~/BigBuckBunny_512kb.ts -f mpegts "srt://127.0.0.1:3000"
gst-launch-1.0 filesrc location=/home/BigBuckBunny_512kb.ts ! srtsink uri=srt://127.0.0.1:3000

Receiver:

ffplay srt://:3000?mode=listener
gst-launch-1.0 -v srtsrc uri=srt://:3000?mode=listener ! tsdemux ! mpeg2dec ! videoconvert ! autovideosink
gst-play-1.0 srt://:3000?mode=listener

B) Send/Receive from srt-live-server

Server command: cd bin && ./sls -c ../sls.conf

Send

gst-launch-1.0 filesrc location=/home/BigBuckBunny_512kb.ts ! mpegvideoparse ! mpegtsmux ! srtsink uri=srt://127.0.0.1:8080/?streamid=uplive.sls.com/live/test

Receive

OBS Studio

Add new "Media Source", double click and uncheck "local file", then add srt://127.0.0.1:8080?streamid=live.sls.com/live/test
as input.

ffplay -fflags nobuffer -i srt://127.0.0.1:8080?streamid=live.sls.com/live/test
gst-launch-1.0 -v srtsrc uri=srt://127.0.0.1:8080?streamid=live.sls.com/live/test ! tsdemux ! mpeg2dec ! videoconvert ! autovideosink

good job!