datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.77k stars 436 forks source link

Stream from Restream.io to RTMP sink in Restreamer only transmitted sound #723

Open DJGummikuh opened 5 months ago

DJGummikuh commented 5 months ago

Describe the bug We tried to relay a RTMP stream via Restreamer that originated from Restream.io from a professional event. The Event organizers use restream.io to stream to a multitude of targets, Twitch among them, and we asked them to also stream to our custom RTMP sink in Restreamer. However, while we got traffic that - measured by the amount - seemed to include video and audio, only audio was accessible on any targets configured. The targets were

I do unfortunately not have the logs in text form. image image

I fail to reproduce this issue on my own. restream.io only allows sending to custom RTMP targets on a paid plan (which I don't have), streaming to the same RTMP target from OBS, ffmpeg, Larix and VLC produces a working stream, including video and audio.

I am therefore not certain that this is a restreamer issue, it could either be an issue triggered by the combination of restream.io and restreamer or some strange source setting from the studio (though I don't believe this to be plausible, as they are streaming to twitch just fine via the same restream.io setup)

To Reproduce Cannot be reproduced by me, see above.

Expected behavior I expect a stream that contains video and audio to survive restreaming by restreamer, so that OBS or any other consuming software receives video alongside audio and not only audio.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context No additional Information available.

Business inquiries

No business inquiry

ioppermann commented 4 months ago

Please try with the latest Restreamer version. We fixed some bugs in our RTMP and switched to ffmpeg 6.1.1.

I also don't have a paid restream.io account in order to test it. It might be that restream.io was sending the video encoded not in H264, but in some othe codec (e.g. H265, VP9, or AV1). Only as of fmpeg 6.1.1 the additional codecs are supported.

DJGummikuh commented 4 months ago

I am pretty certain they sent it in H.264, since they were streaming the same datastream also directly to multiple twitch accounts - which were receiving video just nicely (and to my knowledge, Twitch Ingest currently only supports H.264). Anyways, I will try to find someone who allows me to borrow their restream.io account ^^

DJGummikuh commented 4 months ago

I did retry with the latest Restreamer Version (datarhei-core v16.15.0 (linux/amd64) - bold-hill-3974) and I have the exact same result as before: Audio gets through, video doesn't get through. I managed to pull some more logs from the occasion:

Error Message during Probe:

ffmpeg version 6.1.1-datarhei Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-alsa --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libdav1d --enable-librav1e --disable-ffplay --disable-debug --disable-doc --disable-shared libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100 Input #0, flv, from 'rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp ffmpeg.inputs:[{"url":"rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx,"format":"flv","index":0,"stream":0,"type":"audio","codec":"aac","coder":"aac","bitrate_kbps":0,"duration_sec":0.000000,"language":"und","profile":1,"level":-99,"sampling_hz":48000,"layout":"stereo","channels":2}] At least one output file must be specified

Logging Output Process Details:

@1713958139 ffmpeg version 6.1.1-datarhei Copyright (c) 2000-2023 the FFmpeg developers @1713958139 built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014 @1713958139 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-alsa --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libdav1d --enable-librav1e --disable-ffplay --disable-debug --disable-doc --disable-shared @1713958139 libavutil 58. 29.100 / 58. 29.100 @1713958139 libavcodec 60. 31.102 / 60. 31.102 @1713958139 libavformat 60. 16.100 / 60. 16.100 @1713958139 libavdevice 60. 3.100 / 60. 3.100 @1713958139 libavfilter 9. 12.100 / 9. 12.100 @1713958139 libswscale 7. 5.100 / 7. 5.100 @1713958139 libswresample 4. 12.100 / 4. 12.100 @1713958139 libpostproc 57. 3.100 / 57. 3.100 @1713958140 Input #0, flv, from 'rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx': @1713958140 Duration: N/A, start: 0.000000, bitrate: N/A @1713958140 Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp @1713958140 Stream map '0:1' matches no streams. @1713958140 To ignore this, add a trailing '?' to the map. @1713958140 Failed to set value '0:1' for option 'map': Invalid argument @1713958140 Error parsing options for output file [f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\://admin\:xxxxx@localhost\:8080/memfs/e9d352a9-08ae-46b8-b5a8-a45588f40225_output0%04d.ts:master_pl_name=e9d352a9-08ae-46b8-b5a8-a45588f40225.m3u8:master_pl_publish_rate=2:method=PUT]http://admin:xxxxx@localhost:8080/memfs/e9d352a9-08ae-46b8-b5a8-a45588f40225_output_0.m3u8|[f=flv]rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx. @1713958140 Error opening output files: Invalid argument

Process Details Banner:

ffmpeg version 6.1.1-datarhei Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-alsa --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libdav1d --enable-librav1e --disable-ffplay --disable-debug --disable-doc --disable-shared libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100 Input #0, flv, from 'rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp Stream map '0:1' matches no streams. To ignore this, add a trailing '?' to the map. Failed to set value '0:1' for option 'map': Invalid argument Error parsing options for output file [f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\://admin\:xxxxx@localhost\:8080/memfs/e9d352a9-08ae-46b8-b5a8-a45588f40225_output0%04d.ts:master_pl_name=e9d352a9-08ae-46b8-b5a8-a45588f40225.m3u8:master_pl_publish_rate=2:method=PUT]http://admin:xxxxx@localhost:8080/memfs/e9d352a9-08ae-46b8-b5a8-a45588f40225_output_0.m3u8|[f=flv]rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx. Error opening output files: Invalid argument

Process Details Command:

ffmpeg -err_detect ignore_err -y -fflags +genpts -thread_queue_size 512 -analyzeduration 3000000 -i rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx -dn -sn -map 0:1 -codec:v copy -map 0:0 -codec:a copy -metadata title=https://restreamer.djgummikuh.de/xxxxx/oembed.json -metadata service_provider=datarhei-Restreamer -flags +global_header -tag:v 7 -tag:a 10 -f tee [f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\://admin\:xxxxx@localhost\:8080/memfs/e9d352a9-08ae-46b8-b5a8-a45588f40225_output0%04d.ts:master_pl_name=e9d352a9-08ae-46b8-b5a8-a45588f40225.m3u8:master_pl_publish_rate=2:method=PUT]http://admin:xxxxx@localhost:8080/memfs/e9d352a9-08ae-46b8-b5a8-a45588f40225_output_0.m3u8|[f=flv]rtmp://localhost:1935/xxxxx/xxxxxxx.stream?token=xxxxx

I also talked with the person that sent the stream and he confirmed that he was sending 1920x1080 with 6000kbps x264 with 2s Keyframes and 59.94 FPS, using a Standard OBS. I tried to replace their OBS with mine, but that didn't work (had nothing to do with restreamer, my OBS started acting up all of a sudden), so I cannot with 100% certainty say whether it is restream.io that interacts with restreamer in a funny way or if their OBS is already doing something strange that causes Restreamer to not find a video signal. Restreamer DID have a constant 6000kbps Ingest, so the video signal must definitely have been part of that datastream somewhere.

DJGummikuh commented 4 months ago

I managed to do the test now with my OBS -> restream.io -> Restreamer -> my other OBS with the exact same result (Sound but no Video). OBS -> Restreamer -> Other OBS does work, so the issue must be somewhere between restream.io and Restreamer.