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.78k stars 438 forks source link

Video glitches at the bottom of the frame on still images using SRT #755

Open rrebuffo opened 4 months ago

rrebuffo commented 4 months ago

Describe the bug The image is broken mostly at the bottom third of the frame, repeating lines or showing green/purple/gray glitches. It is specially worst when the stream is showing still images.

To Reproduce Steps to reproduce the behavior:

  1. Add a new channel with an SRT listener
  2. Stream from OBS using NVENC H.264
  3. Play a still image periodically or a live feed with static lower thirds
  4. Preview the stream on HLS/SRT/RTMP

Expected behavior Stable and clean image

Screenshots image

Desktop (please complete the following information):

Additional context Streaming PC is: Windows 10 Pro Core i7-7700 8GB RAM Nvidia 1660 super

It is worth noting that even though I listed those specs, I tested it with many other PCs. All of them using OBS and NVENC over SRT. The problem disappears the moment I switch the source to the RTMP protocol.

ioppermann commented 4 months ago

What is the bitrate you are using? This looks like that many UDP packets get unrecoverably lost. SRT uses UDP for the data transfer. What are the specs of the box where Restreamer is running on? Does it run on the same Windows box?

Happyllama25 commented 3 months ago

I noted this too, exact same issue, same segment of frame too. For now, I just used RTMP instead.

OBS with NVENC over SRT too

It would occur during the web preview but also if I enabled the SRT server and used VLC, I would get the same visual artefacts.

Bitrate 3500, my Restreamer is running on a small 1core 1gb linux container, not doing any transcoding, just forwarding.

rrebuffo commented 3 months ago

Bitrate is anything between 4000Kbps and 10000Kbps, either variable or constant, with no change in the result. It's the same isuue on any bitrate.

Some remarks:

It seems to me a problem with an FFMPEG setting or something. I don't fully understand what I'm saying but could it be related to bad handling of null packets from the encoder?

ioppermann commented 3 months ago

Unfortunately, I don't have Windows machine to test this on. There might be a UDP sending throughput issue.

It is interesting that the problem occurs only when you're streaming a still image. Probably the key frame interval is too high and a few packets got lost. Then these glitches stay until the next key frame.

In the output encoder settings, I suggest that you set a fixed key frame interval of 2 seconds and to disable B-Frames. This is the recommended setting for streaming.

I tested it with these settings. Sending the SRT from my Mac to a Pi 3 runnning Restreamer and I wasn't seeing any glitches.

image
Nono-04 commented 3 months ago

Hi there, We are experiencing the same issue with artifacts showing up when using SRT.

In the output encoder settings, I suggest that you set a fixed key frame interval of 2 seconds and to disable B-Frames. This is the recommended setting for streaming. We have tried this, but unfortunately, it doesn't seem to improve the situation. image

This might be unrelated, but I found the following in the Process Details whenever the artifacts appeared:

@1717856659 [mpegts    ] Packet corrupt (stream = 0, dts = 753300000).
@1717856659 [in#0/mpegts @ 0x7f916d711a80] corrupt input packet in stream 0.