obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.47k stars 8k forks source link

Media source hangs (RTSP), but OBS is unaware #11537

Open dzek69 opened 3 days ago

dzek69 commented 3 days ago

Operating System Info

Ubuntu 24.04

Other OS

KDE Neon 6.2, based on Ubuntu 24.04

OBS Studio Version

30.2.3

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/rJKXLhOZLn5wgVuh

OBS Studio Crash Log URL

No response

Expected Behavior

OBS should be able to find out that the source streams stopped producing frames and restart the source reading

Current Behavior

RTSP stream may stop producing frames, but underlying FFMPEG probably keeps going. The result is the stream being stuck forever. I have to change some property to make OBS restart the source.

Steps to Reproduce

  1. Find a RTSP stream
  2. Add it as source media
  3. Wait for the source media to stop producing frames, while not stopping FFMPEG at the same time (this can be tricky I guess and take forever, making reproduction impossible)

Anything else we should know?

In the OBS log there is no log from ffmpeg, so the event that occured it's basically invisible in the log. The stream died at around 03:06:59 am, in the log file there is nothing between 02:14:58 and 09:40:20. Can I enable more logging somehow?

Anyway.

I was working on a hobby project once that was recording streams using FFMPEG. I had a situation where the stream stopped producing frames, but FFMPEG kept running. As a result, nothing was recorded and this situation was ignored.

So I made a fix and I was observing frame= lines:

frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    
frame=   30 fps= 20 q=33.0 size=    1024kB time=00:00:00.46 bitrate=17976.4kbits/s speed=0.314x    
frame=   58 fps= 29 q=33.0 size=    1536kB time=00:00:00.93 bitrate=13482.1kbits/s speed=0.468x    

And if no such line in the ffmpeg log was produced for 5 seconds - I was considering the recording broken and I was restarting ffmpeg. I think OBS should do the same. The timeout can be configurable I guess, but usually no frames for 5 seconds means the stream is dead.