Trying to record stream in small chunks

Hi there,

I have been using a modified, off the shelf implementation of nginx-rtmp in docker (github.com/efriandika/streaming-server) and my attempts to save incoming streams in chunks has been frustrating at best. As stated in the title, record_interval looks like it’s not being respected.

My RTMP config is as simple as this:

rtmp {
  server {
    listen 1935;
    chunk_size 4096;
    allow publish all;

    application stream {
      record all;
      record_path /opt/data/recordings;
      record_unique on;
      record_interval 3s;

    }
  }
}

And despite the settings for record_interval, I end up with video chunks 120s long each!

As I’m new to streaming I don’t know much about what would cause a delay in recording files, but I did go as far to check if it was a keyframe issue. I’m using the excellent video.api react native project to produce streaming content here, which has a default GOP of 1 second (suggesting I should be getting keyframes every second), suggesting there should be plenty of keyframes to start a new recording on before the 120s mark.

After several hours of not understanding what was going on, I don’t know what to do aside from making a smaller, easier to reproduce test case and submitting as a bug. My Nginx version is 1.23.3 and my rtmp version is 1.2.2, compiled with the following flags:

with-threads
with-file-aio
with-http_ssl_module
with-debug

Any thoughts would be appreciated! My goal here is to create a vod that can be consumed in real time, so chunking to vod and distributing the vod files as little as 3s behind the live stream seemed like a good idea.

Best,

Tim Winter

Read more here: Source link