CSI Camera FPS cannot go above 30 fps

Hi. I am currently setting up a camera on a jetson nano for an imaging system. I have the camera working and streaming video fine however I cannot get the fps to increase above 30 fps even though the supported modes state that I can get 60fps at 1280x720. I am using the c++ code from Jetson Hacks. I have tried lowering the image resolution to see if the jetson is maybe not able to stream the images fast enough. I am using a camera with an imx219 sensor. I have also tried using gstreamer in the terminal. There I can only stream at 21 fps. Any value higher than 21 spits out an error stating that the frame rate is set higher than the supported value. Any advice will be much appreciated.
Thanks

1 Like

Hi @Robert97,

Are you using the IMX219 driver provided by default with latest Jetpack release? The issue probably is related with the default modes and framerates supported by this driver.

Can you share the output of the following command:

v4l2-ctl --device /dev/video0 --list-formats-ext

Hi @fabian.solano,

I am using the latest Jetpack image (4.3) so I am assuming that I am using the drivers as well. I have not installed my own drivers. The output to the command is:

ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'RG10'
	Name        : 10-bit Bayer RGRG/GBGB
		Size: Discrete 3264x2464
			Interval: Discrete 0.048s (21.000 fps)
		Size: Discrete 3264x1848
			Interval: Discrete 0.036s (28.000 fps)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.017s (60.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.017s (60.000 fps)

Thanks for the help.

Hi @Robert97

Ok seems the driver supports framerate over 30. I always try to use v4l-ctl to verify if the frames are correctly being dequeue and that the capture subsystem was configured correctly.

Can you try the following command and share the output:

v4l2-ctl --device /dev/video0 --stream-mmap --stream-count=120 --set-fmt-video=width=1280,height=720,pixelformat=RG10

Then, after executing that command provide the output of the following two commands, than will help to identify what the capture subsystem is configuring

v4l2-ctl -d /dev/video0 --all

media-ctl -d /dev/media0 -p

Regards,
Fabian

Hi @fabian.solano
The first command give the following output:

<<<<<<<<<<<<<<<<<<<<<<< 21.35 fps
<<<<<<<<<<<<<<<<<<<<< 21.28 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.20 fps
<<<<<<<<<<<<<

The output to the second command:

Driver Info (not using libv4l2):
	Driver name   : tegra-video
	Card type     : vi-output, imx219 7-0010
	Bus info      : platform:54080000.vi:0
	Driver version: 4.9.140
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: no power)
Format Video Capture:
	Width/Height      : 3264/2464
	Pixel Format      : 'RG10'
	Field             : None
	Bytes per Line    : 6528
	Size Image        : 16084992
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 

Camera Controls

                     group_hold 0x009a2003 (bool)   : default=0 value=0 flags=execute-on-write
                    sensor_mode 0x009a2008 (int64)  : min=0 max=0 step=0 default=0 value=0 flags=slider
                           gain 0x009a2009 (int64)  : min=0 max=0 step=0 default=0 value=16 flags=slider
                       exposure 0x009a200a (int64)  : min=0 max=0 step=0 default=0 value=13 flags=slider
                     frame_rate 0x009a200b (int64)  : min=0 max=0 step=0 default=0 value=2000000 flags=slider
                    bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0
                override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
                   height_align 0x009a2066 (int)    : min=1 max=16 step=1 default=1 value=1
                     size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
               write_isp_format 0x009a2068 (bool)   : default=0 value=0
       sensor_signal_properties 0x009a2069 (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
        sensor_image_properties 0x009a206a (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
      sensor_control_properties 0x009a206b (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
              sensor_dv_timings 0x009a206c (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
               low_latency_mode 0x009a206d (bool)   : default=0 value=0
                   sensor_modes 0x009a2082 (int)    : min=0 max=30 step=1 default=30 value=5 flags=read-only

And the output to the third:

Media controller API version 0.1.0

Media device information
------------------------
driver          vi
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  0.0.0

Device topology
- entity 1: nvcsi--2 (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		<- "imx219 7-0010":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx219 7-0010":0 [ENABLED]

- entity 4: imx219 7-0010 (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev1
	pad0: Source
		[fmt:SRGGB10_1X10/3264x2464 field:none colorspace:srgb]
		-> "nvcsi--2":0 [ENABLED]

- entity 6: vi-output, imx219 7-0010 (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
	pad0: Sink
		<- "nvcsi--2":1 [ENABLED]

- entity 18: nvcsi--1 (2 pads, 0 link)
             type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
	pad1: Source

Thanks for the help.

Kind Regards,
Robert

Hi @Robert97,

From the output of the second command you can analyze the following lines

Video input : 0 (Camera 0: no power)
Format Video Capture:
Width/Height      : 3264/2464
Pixel Format      : 'RG10'

From the third command:

pad0: Source
	[fmt:SRGGB10_1X10/3264x2464 field:none colorspace:srgb]
	-> "nvcsi--2":0 [ENABLED]

As you can see the capture subsystem is configured for the resolution 3264x2464 and therefore that is why you are only getting 21 FPS (which is expected because that is the framerate that resolution supports). For some reason the driver is not configuring the expected resolution.

Could you please enable the verbose of v4l-ctl when trying to configure the resolution by using the following command:

v4l2-ctl --device /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=RG10 --verbose

You should get an output similar to the following:

VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
Width/Height      : 1280/720
Pixel Format      : 'RG10'
Field             : None
Bytes per Line    : 2560
Size Image        : 1843200
Colorspace        : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization      : Default (maps to Full Range)
Flags             : 

Regards,
Fabian

Hi @fabian.solano,

Sorry for the late reply. I tried to use the command you suggested however the width and height are not being changed. Below is the output to that command:

VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
	Width/Height      : 3264/2464
	Pixel Format      : 'RG10'
	Field             : None
	Bytes per Line    : 6528
	Size Image        : 16084992
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 

kind regards,
Robert

What is your Gstreamer pipeline?

Hi

The gstreamer pipeline I am using is the same one as used in simple_camera.cpp. I have realised though that the reason I wasn’t getting higher than 30 fps is because the waitkey parameter was set to 30 and I did not change it. This means that the code was waiting for 30ms and thus limiting the frame rate. I changed this to 10 and now can get 60 perfectly fine. I am still not sure why the terminal commands don’t allow me to stream above 21 fps. I am still very new to cameras and gstreamer. Thanks for the help.

Regards
Robert

Hard to tell without seeing the pipeline command you use on the terminal command line.