server icon indicating copy to clipboard operation
server copied to clipboard

SRT support for output and input streams

Open TKooijmans opened this issue 5 years ago • 10 comments

Description

SRT seems the way to get stable in and output streams. Maybe to nice to have with CasparCG? please see https://medium.com/@eyevinntechnology/using-ffmpeg-and-srt-to-transport-video-signal-to-the-cloud-7160960f846a

TKooijmans avatar Feb 04 '20 14:02 TKooijmans

FFmpeg in CCGv2.3 should support some form of SRT (it's from 2019-02-21 and SRT was added in late '17 or early '18).

However keep in mind that since ffmpeg would be running as a listener and most likely not producing any output until it receives a connection so it might not be handled correctly in CCG. Also it probably doesn't handle disconnects/reconnects like we'd want.

You can easily run ffmpeg in another process, receiving the SRT and moving it over to UDP/RTP unicast or multicast for consumption in CCG.

hreinnbeck avatar Feb 12 '20 18:02 hreinnbeck

Hi, Can we get fully srt support in LTS version please ?

sirfnomi avatar Jun 05 '20 13:06 sirfnomi

Have you tested it? I think it should be available through ffmpeg by using "srt://" as the output protocol.

If we were to add something like SRT I would much prefer using a protocol designed by and for professionals, like RIST.

hreinnbeck avatar Jun 05 '20 13:06 hreinnbeck

Unfortunately, it is too late in the development cycle to get anything new like this into 2.3. But hopefully it will work through ffmpeg already, as 2.3 is using a very new release

Julusian avatar Jun 05 '20 14:06 Julusian

Yes, I tried with srt:// but getting exception .. I think srt protocol is not supported in this ffmpeg version

sirfnomi avatar Jun 09 '20 13:06 sirfnomi

I haven't checked the version bundled with casparcg but afaik you have to use a manually compiled version of ffmpeg to get srt-support. Perhaps the final 2.3 version could at least have ffmpeg with libsrt enabled, if it is currently not.

You can easily run ffmpeg in another process, receiving the SRT and moving it over to UDP/RTP unicast or multicast for consumption in CCG.

You wouldn't necessarily need ffmpeg for that but could use srt-live-transmit

herzogmedia avatar Jun 09 '20 13:06 herzogmedia

Yeah, it turns out the ffmpeg 4.2.x builds from https://ffmpeg.zeranoe.com/builds/ arent built with libsrt support. The unstable builds there do, so you might be build casparcg 2.3 yourself against those (and save building ffmpeg), but we wont be including those in the 2.3 releases, but they will be included at some point in the future.

Julusian avatar Jun 09 '20 14:06 Julusian

Hello, what is needed to implement srt:// in CasparCG? I already changed my ffmpeg and ffplay-binarys to the latest 4.4 which are builded with libsrt. But this is not enough.

What else is needed?

Bond246 avatar Jul 09 '21 10:07 Bond246

I wonder if you might have to SRT to this function https://github.com/CasparCG/server/blob/5e6e83f5d6645a147d1f25eab23dd7aaf605ca52/src/modules/ffmpeg/producer/av_input.cpp#L129

mint-dewit avatar Jul 09 '21 11:07 mint-dewit

Hello @baltedewit ,

thanks for support. I changed that for personal dev-test: if (url_parts.first == L"http" || url_parts.first == L"https" || url_parts.first == L"srt") {

But there seems to be a problem:

[2021-07-13 22:52:59.538] [info] Received message from 127.0.0.1: PLAY 1-10 "srt://[someIP]:30313" CUT 1 Linear RIGHT\r\n [2021-07-13 22:52:59.538] [info] Sent message to 127.0.0.1:202 PLAY OK\r\n [2021-07-13 22:52:59.539] [error] Exception: D:\Programme\VisualStudio\Repos\CasparCG-Server\src\modules\ffmpeg\producer\av_input.cpp(147): Throw in function auto _cdecl caspar::ffmpeg::Input::internal_reset::<lambda_e2cbc8152b240f102cb1314dcbd7d635>::operator ()(void) const [2021-07-13 22:52:59.539] [error] Dynamic exception type: class boost::exception_detail::clone_impl [2021-07-13 22:52:59.539] [error] [struct boost::errinfo_api_function * ptr64] = avformat_open_input(&ic, filename.c_str(), input_format, &options) [2021-07-13 22:52:59.539] [error] [struct boost::errinfo_errno * __ptr64] = 1330794744, "Unknown error" [2021-07-13 22:52:59.539] [error] [struct caspar::ffmpeg::tag_ffmpeg_errn_info * __ptr64] = -1330794744 [2021-07-13 22:52:59.539] [error] [struct caspar::tag_stacktrace_info * __ptr64] = 0# 0x00007FF642C7525E in casparcg

Bond246 avatar Jul 13 '21 21:07 Bond246