libcamerasrc and formats?

Florian Echtler floe at butterbrot.org
Wed Mar 22 09:23:28 UTC 2023


Sorry, my mistake. I assume to replicate the behaviour of libcamera-vid, I would 
simply have to combine libcamerasrc and v4l2h264enc?

On 22.03.23 10:15, Florian Echtler via gstreamer-devel wrote:
> P.S. a follow-up question: at the moment, I can't use libcamerasrc to directly 
> stream H.264 from the camera, correct?
> 
> On 17.03.23 20:21, Nicolas Dufresne wrote:
>> Hi,
>>
>> Le vendredi 17 mars 2023 à 10:21 +0100, Florian Echtler a écrit :
>>> Thank you - turns out it's rather hard to build libcamera on the target device,
>>> which is a Raspberry Pi Zero. I'll test with another Raspi ASAP.
>>>
>>
>> Meson based projects aren't too hard to cross compile, there is a concises
>> instruction how to set this up a toolchain for RPi OS:
>>
>> https://deardevices.com/2019/04/18/how-to-crosscompile-raspi/
>>
>> I would have hoped for already made docker image. I never tried this. An
>> alternative I've used (though I have a Pi4 now with 8G of RAM), is to use qemu
>> to chroot into the SD card rootfs and just build using emulation.
>>
>> regards,
>> Nicolas
>>
>>>
>>> Best, Florian
>>>
>>> On 15.03.23 19:13, Nicolas Dufresne wrote:
>>>> Hi,
>>>>
>>>> Le mercredi 15 mars 2023 à 17:24 +0100, Florian Echtler via gstreamer-devel a
>>>> écrit :
>>>>> Hello everyone,
>>>>>
>>>>> I'm experimenting with a Raspberry Pi camera and would like to process the
>>>>> frames with OpenCV. Apparently, the "modern" way of doing so is through
>>>>> libcamera, and for OpenCV, this means using a GStreamer pipeline with 
>>>>> libcamerasrc.
>>>>>
>>>>> For efficiency reasons, I'd like to get a grayscale image directly from the
>>>>> camera to avoid unneeded conversions; so I used the following pipeline:
>>>>>
>>>>> libcamerasrc !
>>>>> video/x-raw,width=(int)640,height=(int)480,framerate=(fraction)30/1,format=GRAY
>>>>> ! appsink
>>>>>
>>>>> "GRAY" is listed as a supported format for the camera in the Video4Linux 
>>>>> device,
>>>>> but I don't get a working pipeline when I try that. If I leave out the format
>>>>> parameter, then I'm getting NV12 (or I can pick something generic like 
>>>>> RGB). How
>>>>> can I see which formats I can actually get out of libcamerasrc and the sensor?
>>>>
>>>> Any chance you can give this patch a try ? I'll post it to the libcamera 
>>>> project
>>>> if you can confirm its working. Note that libcamerasrc is entirely developed as
>>>> part of libcamera project.
>>>>
>>>> ---
>>>> commit abf017f5c0f547ceaa863e658f22af9f547a863d (HEAD -> logger-crash)
>>>> Author: Nicolas Dufresne <nicolas.dufresne at collabora.com>
>>>> Date:   Wed Mar 15 14:10:08 2023 -0400
>>>>
>>>>       gstreamer: Map R8 pixel format
>>>>       This enables monochrome 8bit to be supported in libcamerasrc.
>>>>       Signed-off-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
>>>>
>>>> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-
>>>> utils.cpp
>>>> index 750ec351..f1e34b60 100644
>>>> --- a/src/gstreamer/gstlibcamera-utils.cpp
>>>> +++ b/src/gstreamer/gstlibcamera-utils.cpp
>>>> @@ -26,6 +26,9 @@ static struct {
>>>>           { GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },
>>>>           { GST_VIDEO_FORMAT_ENCODED, formats::SRGGB8 },
>>>> +       /* Monochrome */
>>>> +       { GST_VIDEO_FORMAT_GRAY8, formats::R8 },
>>>> +
>>>>           /* RGB16 */
>>>>           { GST_VIDEO_FORMAT_RGB16, formats::RGB565 },
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> SENT FROM MY DEC VT50 TERMINAL
>>>
>>
> 

-- 
SENT FROM MY DEC VT50 TERMINAL

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230322/af60d276/attachment-0001.sig>


More information about the gstreamer-devel mailing list