Hello, I’ve been using the OV9281 camera bundle to record stereo videos for a motion tracking system. So far, I have been able to record videos using command line calls from libcamera-vid.
Using the call: libcamera-vid --width 2560 --height 800 -t 9000 -o test.mp4 works for capturing a 9 second video of the scene. The preview of the video recording on the raspberry pi appears as a full frame (2560 x 800). However when I go to process these images for analysis (currently using opencv in python [import cv2]), I only get 1920x800 frame sizes. Half of one of the camera frames is missing. Has anyone ran into this issue? I’m not sure if there’s another way I should be processing these files (do I have to unpack the bits myself) or if there’s an alternative way to capture the images on the raspberry pi so that I don’t run into this issue. Any thoughts on this topic would be helpful. Thank you.
Hi,
Thanks for reaching out. The behavior you’re observing where your 2560x800 video recorded with libcamera-vid appears as 1920x800 when processed with OpenCV on the Raspberry Pi is a known limitation.
The Raspberry Pi’s hardware-accelerated video decoder (which OpenCV typically uses by default via FFmpeg/GStreamer) generally has a maximum resolution it can handle, often up to 1920x1080 (Full HD).
When you try to decode a video file that is wider than 1920 pixels (like your 2560x800 video) on the Raspberry Pi itself using common libraries like OpenCV, the hardware decoder may either:
-
Fail to decode it properly.
-
Truncate the frame to its maximum supported width (1920 pixels in this case), leading to the loss of the remaining 640 pixels of width. This seems to be what’s happening to you.
So, while libcamera-vid can successfully capture and encode the full 2560x800 resolution (and the preview reflects this as it’s showing the direct camera output before it’s heavily processed or decoded from a file), the decoding stage on the Pi for analysis with OpenCV is hitting this hardware limit.
I see, thank you for the reply. Do you have any suggestions as to how to approach processing the full frame (either on the fly or in post processing)? Are their any libraries or methods to access all the image pixels? I am currently interested in using the dual camera for object tracking so I am working on extracting the position of the object in each frame (the only thing I really need to store right now).
Thank you.