This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Incorrect camera framerate Pi Camera
#1
Hi,

i have been following instructions on the CSI page of the tinkerboarding wiki to use the raspberry pi camera v2 together with the tinkerboard. It works fine, but there is an issue with the camera framerate that is twice the one expected. When capturing the camera video with gstreamer to output a mpeg-ts video, it works fine in the player (no speed-up or slow down), but if you dump the h264 straight in a file (gst-launch-1.0 v4l2src num-buffers=500 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue ! mpph264enc ! queue ! filesink location=./test.h264) with no container, the 30fps video is indeed a 60fps video (you have to speed up the footage to have the correct speed in the scene).

Since the v4l2 driver for the camera is not well built, there is not v4l2-ctrl to change the video aspect ratio or fps for the v4l2src in gstreamer.  In the TinkerOS image there is a strange foler (~/camera/) with a script to copy xml configurations to /etc/cam_iq. This script contains information about the camera FPS and more but i don't know if altering those can affect the camera settings.

Any idea on how to get the correct framerate ?
Reply
#2
looking at the kernel code, i found the code that configure the camera module in : imx219_v4l2-i2c-subdev.c


In this file, it seems that the framerate is set at 48FPS and not 30 as expected. Since there is no mention of a 640x480 resolution, i guess that any resolution below 1920x1080 is down-sampled by the ISP. One key difference with the way the raspberry-pi processes the image, is that when the Pi VPU is used to encode to h264 the video it automatically set the sensor to its full resolution and output and uses the VPU/ISP to rescale the image before encoding. In Rockchip support of the camera, the ISP is not configured to do anything like that, which result in a highly reduced fiedl of view when using resolutions different than the full sensor.
Reply
#3
Hi,

i have now enabled the 1640x922 in the v4l2-subdevdriver for the imx219. Now when i issue a v4l2-ctl command i get the resolution 1920*1080, but if i issue the same command again, i get the 1640x922 resolution listed. I have not clue now on how to set the active configuration for the sensor. Another problem is that if i try to grab this new resolution, the encoder does not seem to enjoy it and output  bad data.
Reply
#4
With the 1640x922@30FPS mode enabled in on the v4l2-sub driver, when i grab 1080p video at 30fps, i get 1080p video at 30fps without the horizontal cropping. I have no clue of why but it seems that asking for 30fps gets the 1640x922@30FPS mode enabled on the camera side and that the ISP takes care of the resizing without the cropping (much like the Pi does). There is still one major hiccup with the driver. The device-tree configuration for the board is not properly setup and the camera config (from the dts file) gets loaded before the camera power is enabled. This result in the camera settings in the device-tree file to have no effect on the camera (and a bunch of error to show up in the syslog).
Reply
#5
(08-13-2018, 10:44 AM)jpiat Wrote: Hi,

i have now enabled the 1640x922 in the v4l2-subdevdriver for the imx219. Now when i issue a v4l2-ctl command i get the resolution 1920*1080, but if i issue the same command again, i get the 1640x922 resolution listed. I have not clue now on how to set the active configuration for the sensor. Another problem is that if i try to grab this new resolution, the encoder does not seem to enjoy it and output  bad data.

CSI camera frame rate is fixed, only hard code to modify it.
Please try to use attached patch to change camera 1920x1080 47fps to 30fps.


Attached Files
.zip   patch.zip (Size: 1.15 KB / Downloads: 2)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)