I'm having a hard finding a simple solution to showcase the srt
streaming protocol with FFmpeg. The only article that I've found, is either going over multiple hoops to setup a stream. Is there no way to do a simple receiver/sender principle like in the old days with udp?
Sender:
ffmpeg -i myfile.mp4 -vcodec libx264 -crf 12 -f mpegts udp://192.168.1.5:1234
Receiver:
ffplay udp://192.168.1.5:1234
Your ffmpeg
needs to be compiled with --enable-libsrt
to support the SRT protocol. See the output of ffmpeg -protocols
to determine if it supports SRT.
Untested examples:
# stream copy
ffmpeg -re -i input.mp4 -c copy -f mpegts srt://192.168.1.5:1234
# re-encode
ffmpeg -re -i input.mp4 -c:v libx264 -b:v 4000k -maxrate 4000k -bufsize 8000k -g 50 -f mpegts srt://192.168.1.5:1234
I also miss comprehensive documentation and explanation on how to use SRT. However here is a minimum example I use:
Sender which acts as a listener and waits for connections:
ffmpeg -i test.mp4 -c:v libx264 -f mpegts 'srt://:40052?mode=listener&latency=20000000'
Receiver which acts as a caller:
ffmpeg -i 'srt://192.168.1.345:40052?mode=caller' -c copy output.mkv
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.