How to configure FFmpeg to drop or generate frames when feeding input via pipe to maintain a specific framerate?

I’m feeding FFmpeg via pipe to generate an output video. However, I want FFmpeg to either drop or generate frames only if necessary to maintain the specified framerate, regardless of variations in the number of frames I send.

I’m using the following command, but I’m encountering issues where, if I send too many frames, the video plays in slow motion, and if I send too few frames, it plays too fast.

-f rawvideo -r 60 -s 1920x1080 -i pipe:0 -c:v nvenc -preset fast -b:v 3000k -y output.mp4

Read more here: Source link