Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera stuck in FullHD mode #111

Open
afdaniele opened this issue May 17, 2021 · 1 comment
Open

Camera stuck in FullHD mode #111

afdaniele opened this issue May 17, 2021 · 1 comment

Comments

@afdaniele
Copy link

Hi, I'm having a hard time getting the camera to use a different sensor mode. The camera seems to be switching mode but always returning image with resolution 1920x1080, regardless of what I pass to the sensor-mode argument.

If I run the following pipeline, I get the correct image

gst-launch-1.0 rpicamsrc sensor-mode=1920x1080 ! video/x-raw, width=1920, height=1080, format=RGB ! jpegenc snapshot=TRUE ! filesink location=image.jpg

good

Though, if I try to select the sensor mode 1296x972 with the following pipeline, this is what I get

gst-launch-1.0 rpicamsrc sensor-mode=1296x972 ! video/x-raw, width=1296, height=972, format=RGB ! jpegenc snapshot=TRUE ! filesink location=image.jpg

bad

Now, if I mix things up, so choose the sensor mode 1296x972 but don't specify the resolution, I get the following image, which is (visibly) correct, has a wider field-of-view (as expected given that the mode 1296x972 has a wider field-of-view compared to 1920x1080) but the size of the image is still 1920x1080.

gst-launch-1.0 rpicamsrc sensor-mode=1296x972 ! video/x-raw, format=RGB ! jpegenc snapshot=TRUE ! filesink location=image.jpg

full

The artifacts look like they come from a rowbyte/stride problem.
Any idea what the cause could be?

My environment:

  • rpicamsrc built from source, commit: f6b5762
  • Ubuntu 20.04 (arm64)
  • Raspberry Pi 4B 4GB
  • Raspberry Pi camera V1
  • Gstreamer 1.16.2
@thaytan
Copy link
Owner

thaytan commented May 18, 2021

I haven't tried the raw image output mode for a long time - I normally use h264 or jpeg capture, because the transfer from the VPU to CPU is inefficient for raw frames and limits you to just a couple of FPS. If your goal is to record jpeg files, you should let the VPU do that encoding:

gst-launch-1.0 rpicamsrc sensor-mode=1296x972 num-buffers=1 ! image/jpeg ! filesink location=image.jpg

The stride problem is definitely a bug though.

I think the output size choice is something to improve, but not necessarily a bug. The output resolution is negotiated independently of the capture resolution. If you add the resolution to the output capsfilter it should do what you want:

gst-launch-1.0 rpicamsrc sensor-mode=1296x972 ! video/x-raw, format=RGB,width=1296,height=972 ! jpegenc snapshot=TRUE ! filesink location=image.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants