Audio-Video Delay When Fetching From NGINX-RTMP live-Mode

Viewed 356

We get an RTSP-stream and mix it together with line-in over pulseaudio.

This looks something like:

ffmpeg \
  -use_wallclock_as_timestamps 1  -fflags +genpts    \
  -max_delay 2000000 -thread_queue_size 1024         \
  -i "rtsp://url"           \
  -use_wallclock_as_timestamps 1  -fflags +genpts    \
  -max_delay 2000000 -thread_queue_size 1024         \
  -itsoffset <offset>       \
  -f pulse                  \
  [...]

So far so good. This kind of works when fetching the rtsp stream directly.

As soon as we route the RTSP-stream through an NGINX-RTMP loopback (live mode) beforehand,

ffmpeg -i rtsp://url -c copy -an -f flv rtmp://localhost/live

ffmpeg \
  -use_wallclock_as_timestamps 1  -fflags +genpts    \
  -max_delay 2000000 -thread_queue_size 1024         \
  -i "rtmp://localhost/live"                         \
  -use_wallclock_as_timestamps 1  -fflags +genpts    \
  -max_delay 2000000 -thread_queue_size 1024         \
  -itsoffset <offset>                                \
  -f pulse                                           \
  [...]

we get a delay of close to 5 s within the output (audio-video offset).

Whereat the configuration of rtmp://localhost/live is:

application live {
      live on;
      sync 10ms;
      record off;
      allow publish 127.0.0.1;
      deny publish all;
      }

What causes the delay and how to get rid of it?

The RTMP-server itself does not cause a noticeable delay, I hence assume this to be a timestamp issue but my wisdom ends with the above written options.

0 Answers
Related