Hi
I’m trying to build a setup that will allow us to stream video content in 720p taking advantage of the SRT protocol and Cloudflare network and restream result to our servers for mixing purposes.
I tried two setups while streaming same mp4 file.
But when streaming using RTMPS - all output software options can receive and process the stream,
but when streaming using SRT - all output software options cannot process the stream (except youtube)
here is ffprobe output for this file
ffprobe sample_720p.mp4
ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample_720p.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.16.100
Duration: 00:00:09.73, start: 0.000000, bitrate: 2203 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 2160 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 62 kb/s (default)
Metadata:
handler_name : SoundHandler
Setup 1
ffmpeg streams sample.mp4 file to Cloudflare using RTMPS
here is how I am doing this
docker run -v /srt-test:/srt-test -w /srt-test jrottenberg/ffmpeg:5.0-ubuntu -re -stream_loop -1 -i sample_720p.mp4 -map 0:0 -map 0:1 -c:v copy -c:a copy -f flv rtmps://live.cloudflare.com:443/live/xoxoxoxoxoxoxoxoxoxxoxoxoxox
Output is routed to 4 different RTMP sources
- RTMP stream to SRS server - streaming works very well (audio and video present)
- Youtube livestream - works perfectly!
- RTMP stream to OvenMediaEngine - works well!
- RTMP stream to rtsp-simple-server - works well!
Setup 2
ffmpeg streams sample.mp4 file to Cloudflare using SRT
docker run -v /srt-test:/srt-test -w /srt-test jrottenberg/ffmpeg:5.0-ubuntu -re -stream_loop -1 -i sample_720p.mp4 -map 0:0 -map 0:1 -c:v copy -c:a copy -f mpegts srt://live.cloudflare.com:778?passphrase=aeaeaeaeaeaeaeaeaeaeaeaeae
Output is routed to 4 different RTMP sources
- RTMP stream to SRS server - streaming does not work. SRS shows errors like this
[2022-05-25 11:27:42.458][Warn][1][98524991][11] aac ignore type=1 for no sequence header
[2022-05-25 11:27:42.459][Error][1][98524991][4] serve error code=5011 : service cycle : rtmp: stream service : rtmp: receive thread : handle publish message : rtmp: consume message : rtmp: consume audio : bridger consume audio : aac append header : adts
- Youtube livestream - works perfectly!
- RTMP stream to OvenMediaEngine - stream does not work. OvenMediaEngine shows errors
[2022-05-25 11:43:36.748] W [Decaac:14774] Transcoder | transcoder_filter.cpp:101 | Timestamp has changed abnormally. 63956358990871 -> 63958506474540
[2022-05-25 11:43:37.095] W [InboundWorker:45] MediaRouter | mediarouter_stream.cpp:1104 | Detected abnormal increased timestamp. track:1 last.pts: 63958506474540, cur.pts: 639606
53958210, tb(1/1000), diff: 2147483ms
- RTMP stream to rtsp-simple-server - does not work. rtsp-simple-server shows errors
rtsp-simple-server_1 | 2022/05/25 13:49:49 INF [RTMP] [conn 172.70.245.15:27650] opened
rtsp-simple-server_1 | 2022/05/25 13:49:49 INF [RTMP] [conn 172.70.245.15:27650] closed (unexpected packet (6))
So in second case when streaming using SRT to Cloudflare I have 3 different opensource solutions that cannot process RTMP stream from Cloudflare, while all they work well, when initial stream was sent with Cloudflare RTMP.
And in both cases Youtube works well)
Can we please somehow work it out? I can provide further assistance and more details.