Rtmp2sink error "Connection error: connection closed remotely" while streaming to youtube for 6 hours strait

GStreamer 1.23 on a Raspberry Pi 3B. Using rust.

Source code can be found here: https://github.com/InfiniteCoder01/NewYear2024Event/blob/master/crates/scheduler/src/streamer.rs

As for what I can see on the recording, the stream ended rapidly.
Stream recording: https://www.youtube.com/watch?v=OrblipaeOsc

I just stream using rtmp2sink element to rtmp://a.rtmp.youtube.com/live2/{SECRET_KEY}. Maybe I should switch to backup URL in such cases, but I have no idea on how to do this dynamically with GStreamer.

I found this video, explaining the process of streaming from a headless server to youtube via FFmpeg and it uses same URL.

Got it again after 5 hours of continuous streaming. Note, that Raspberry Pi was building rust with one job at the same time

I think, I found it out. The moment this error happens is when the Pi gets overloaded and YouTube decides, that it doesn’t recieve enough frames. Youtube ends the stream and Pi can’t send data anymore

1 Like

Funny enough, that this was caused by another issue: [ubuntu] What is "exe" process? High CPU usage

Thank you for sharing the underlying root cause of the issue.