I am using the nginx-rtmp-module for accepting RTMP streams and then publishing them locally for transcoding with FFmpeg.

After a recording is made, there is an observable freeze in the video for the first ~1-2 seconds, but the audio plays without issue. After that initial pause, the video will start playing without issue.

This issue only appears when the FFmpeg process starts after the RTMP stream has already been published locally. If the FFmpeg process is started before the RTMP stream has been received by the nginx-rtmp-module, I do not observe the freeze.

I would like to know what is causing this issue and if it can be avoided. Any assistance would be greatly appreciated. Thank you.


[Internet] -------->[RTMP stream]-------->[Server running nginx-rtmp-module]-------->[FFmpeg attached to locally publish RTMP stream (rtmp://localhost/live/stream-key)]

Tools used:


FFmpeg version 5.1.3-1

Example command:

ffmpeg -loglevel info -hide_banner -y \
-i rtmp://localhost/live/stream-key \
-c:v libx264 -s 640x360 -b:v 600k -profile:v main -preset veryfast \
-c:a copy \

1 Answer 1


I found a solution on the nginx side by setting the wait_key and wait_video options to on in the nginx.conf file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.