Inconsistent fps while recording with ffmpeg

So I’m trying to record a video using this camera, my problem is that the fps fluctuate way too much.
To record a video I’m using ffmpeg, this version to be more precise, since there’s no support for nvenc with ffmpeg. The script to make the recording is a very simple one and can be reduced to this pseudocode.

while True:
----cam.grab_frame()
----ffmpeg_recorder.write_frame()

I can ensure that the camera grabs 67 frames per second and the frame captured it’s always the last one. FMPEG is called inside a thread and a queue is used for communication. The camera captures a 2592x1944 image and FFMPEG is set up so it can record a 1080p@60fps video. In reality at best I can capture 1080@50fps with hevc_nvmpi, this is fine. By the way I’m using ffmpeg-python to control the pipeline.

If I could capture 1080@50fps that would be enough for me but like I said at the start the fps fluctuate a lot under the same parameters. In what I call “good runs” the NVENC frequency is set at 499MHz and doesn’t change too much, in turn I record at 1080@50fps. My problem is with “bad runs” in wich the frequency gets stuck at 422 MHz so I can only record at 1080p@30-37 fps.

Some additional info, at first I thought this could be a problem related to the temperature my Jetson, so I increased the fan power from 50% to 100% this didn’t change much. The power mode as seen with jtop is NV POWER[2] 15W 6CORE. The temperature never goes above 50 C and it fluctuates between 43-47C.

Is there a way to solve this?

Hi,
Please refer to steps in
Jetson Nano FAQ
Q: I have a USB camera. How can I launch it on Jetson Nano?

See if you can launch it in gstreamer pipeline. If it can be launched, please try to replace nvoverlaysink with

... ! fpsdisplaysink text-overlay=0 video-sink=nvoverlaysink sync=0 -v

The fps information will be printed out with the plugin.

thanks for the quick response, but the cameras don’t appear in /dev/ in fact you need the Vimba API to make the connection. So I can’t directly launch it with GStreamer.

Hi,
Does it support capturing frames through v4l2? This is the default mode and most samples are demonstrated on the basis of it. If the camera runs in a different mode and requires additional driver, this would need other users to share experience.

Yeah, I will try to solve this, but also I’m going to run some tests with gstreamer, maybe it’s a better option.

got a way better experience using Gstreamer, reached 1080p60 easily.