HLS Stream falling behind the current time.

Joined
Jan 17, 2024
Messages
3
Reaction score
0
Location
EU
Hi there. I have put together a Raspberry Pi 3 based camera system using a standard Logitech C920 webcam. Output is 720p H264 at a fixed 30 FPS rate. Chunks are served using a standard Apache webserver from a ramdisk. Encoder is ffmpeg using Pi's hardware codecs. Bitrate is about 6mbits/s

Blue Iris works fine with this stream however, after a while the video starts to fall behind the current time (clearly visible from the overlays I have added using ffmpeg which show camera's time) as if it was playing slower than intended. (even though BI's Camera Settings show the correct framerate). Eventually this results in BI trying to grab HLS chunks which are no longer there. This causes the video to freeze for some time and then reset. I can increase chunk retention time but that will simply increase the interval between freeze-ups, not fix the issue.

I can see from encoder logs that the bitrate is fixed 30 FPS and does not vary.
Any ideas what could be causing this issue ? Video format issue ? Bug in BI ?
 

steve1225

Getting comfortable
Joined
Apr 11, 2020
Messages
299
Reaction score
365
Location
Poland/Portugal
Hi there. I have put together a Raspberry Pi 3 based camera system using a standard Logitech C920 webcam. Output is 720p H264 at a fixed 30 FPS rate. Chunks are served using a standard Apache webserver from a ramdisk. Encoder is ffmpeg using Pi's hardware codecs. Bitrate is about 6mbits/s

I can see from encoder logs that the bitrate is fixed 30 FPS and does not vary.
Any ideas what could be causing this issue ? Video format issue ? Bug in BI ?
HLS is not a protocol for REAL TIME streaming.
It always create a few seconds delay. Stream is divided into 2-4 seconds chunks, which can be downloaded when they are full / finished..

It was designed for streaming apps like Netflix & Youtube where a few seconds delay is not a problem. Not for real time streaming from security cams...

For real time streaming use RTSP..
 
Joined
Jan 17, 2024
Messages
3
Reaction score
0
Location
EU
I am fully aware of this, I have 5 other cameras installed which all use RTSP. I know how HLS works I do expect some lagging behind the current time due to using HLS. What I don't expect is for the interval between the current time and what is being played to gradually increase as time passes, I expect it to remain somewhat constant. There is almost no network latency as the device is on a local wired network. So latency alone would not explain the issue.
I choose HLS so I can also stream the video in a browser, something you can't do with RTSP. I could generate a "true" livestream using something like an FLV or plain TS, but BI only supports etiher RTMP/RTSP protocols or HLS.
Adding RTSP support would require at least something like VLC or another tool capable of outputting RTSP streams. I could certainly add that, but I would like to keep the system simple if possible.
 
Joined
Jan 17, 2024
Messages
3
Reaction score
0
Location
EU
Never mind. I modified the system output an RTSP stream for Blue Iris using MediaMTX as RTSP server. HLS stream is now transmuxed from RTSP.
This way, both the browser and Blue Iris will be happy.
 
Top