CESNET / UltraGrid

UltraGrid low-latency audio and video network transmission system
http://www.ultragrid.cz
Other
508 stars 53 forks source link

srt stream support #59

Open erichorwitz opened 4 years ago

erichorwitz commented 4 years ago

Would it be possible to add SRT stream support?

Thanks

alatteri commented 4 years ago

SRT would be amazing... and I am sure if you were open to it, we could get a bunch of people to crowd fund/sponsor its development.

R6A8kJOk commented 4 years ago

+1

I see that you investigated not decoding corrupted frames (link in that wiki page is dead now), but that plus SRT for adjustable latency + recovery on lossy networks would be awesome.

Has anyone tried piping Ultragrid through the srt-live-transmit tool?

KeenanMock commented 4 years ago

+1

krzimmer commented 4 years ago

I'm going to try what @R6A8kJOk suggested. I'm new to UG, so I need to figure out how to send the output to pipe.

alatteri commented 4 years ago

Has anyone tried piping Ultragrid through the srt-live-transmit tool?

This is a good idea for testing, but I don't think this would work in combination with reflectors.

R6A8kJOk commented 4 years ago

I’d try this:

On the sender side: Listen on SRT port e.g. 6000, send it to remote:7000 Send Ultragrid to localhost:6000

On the receiver side: Listen on SRT 7000, output to localhost:8000 Listen with Ultragrid on localhost:8000

This would probably break Ultragrid reflectors, but SRT has their own flavor I believe.

alatteri commented 4 years ago

How to deal with the fact that UG sends video and audio on separate ports? Run 2 instances of srt?

R6A8kJOk commented 4 years ago

Worth a try. Could work, might break sync. Try video only first maybe.

krzimmer commented 4 years ago

I couldn't figure out how to only output UG to pipe. srt-live-transmit only accepts udp/srt input, so I did this: UG RTSP -> ffmpeg(codec copy) SRT -> SRT VLC That works, but latency increase is significant even with latency=0 with SRT.

./uv -t avfoundation:device=2:mode=15:fps=30 -c libavcodec:encoder=h264_videotoolbox:bitrate=2M --video-protocol rtsp 127.0.0.1 ffmpeg -i rtsp://127.0.0.1:8554/ultragrid -c copy -f mpegts 'srt://0.0.0.0:7000?pkt_size=1128&mode=listener&nakreport=1&listen_timeout=-1'

alatteri commented 4 years ago

You should not need a pipe, just tell srt to listen on the port that UG sends to, which by default is 5004. In theory is should be something like: srt-live-transmit udp://:5004 srt://IP:port

R6A8kJOk commented 4 years ago

Pipe as in move through a series of ports. Not literal Unix pipes.

krzimmer commented 4 years ago

Alright. Video does not load in VLC with that configuration. ./uv -t avfoundation:device=2:mode=15:fps=30 -c libavcodec:encoder=h264_videotoolbox:bitrate=2M --video-protocol rtsp 127.0.0.1 srt-live-transmit udp://:5004 'srt://:7000mode=listener&nakreport=1&listen_timeout=-1'

I also tried with UltraGrid RTP protocol. Still no.

krzimmer commented 4 years ago

RTSP is a server and udp for SRT input is a listener, so that won't work. Same for RTSP SDP.

krzimmer commented 4 years ago

image

ffplay doesn't like playing the direct output of UG.

./uv -t avfoundation:device=2:mode=15:fps=30 -c libavcodec:encoder=h264_videotoolbox:bitrate=2M 127.0.0.1 ffplay udp://127.0.0.1:5004

alatteri commented 4 years ago

See this workaround.

https://github.com/CESNET/UltraGrid/wiki/SRT-encapsulation

MartinPulec commented 2 years ago

Just for the record, we've started the implementation some time ago, it was at least basically usable (IIRC). I've rebased it over current code, however we've slightly lost a bit interest in it so it is uncertain if it will be merged in future.

alatteri commented 2 years ago

Thanks for the update. I'm also less interested in this as using the external srt-live-transmit works fine.

R6A8kJOk commented 2 years ago

I'm still interested - but I see that the external appears to work fine as well.