[libcamera-devel] libcamera on pinephone

Rafael Diniz rafael at riseup.net
Sun Jul 3 16:32:36 CEST 2022


I have some problems with GL, but using "-s pixelformat=YUYV" image 
appears on screen! But totally garbled some stripes, image doubled in 
the screen - clearly the colorspace conversion is not correct.

Rafael

On 7/3/22 10:51, Laurent Pinchart wrote:
> On Sun, Jul 03, 2022 at 04:18:03PM +0300, Rafael Diniz wrote:
>> With stock libcamera I can not get qcam working here. I get:
>>
>> (some sensors warnings...)
>>
>> [0:39:35.513864964] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.514260589] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.514607297] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.514932172] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.515247422] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.515553922] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.515863172] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.516295714] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.516623505] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>> [0:39:35.516936630] [5059]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
> 
> This we should fix in the libcamera core.
> 
>> [0:39:44.010041343] [5051]  INFO Camera camera.cpp:1029 configuring streams: (0) 1600x1200-SBGGR8
>> Failed to set viewfinder format
>> [0:39:52.372775513] [5051]  INFO Camera camera.cpp:1029 configuring streams: (0) 1600x1200-SBGGR8
>> Failed to set viewfinder format
> 
> qcam doesn't have support for CPU-based debayering. You can try to
> either select a different pixel format (with `-s pixelformat=YUYV` for
> instance), or use the OpenGL ES renderer that supports debayering
> (`-r gles`). Ideally qcam should pick the most efficient renderer
> automatically based on the pixel format and the capabilities of the
> platform.
> 
>> And then I get no image in qcam window, after selecting the camera.
>>
>> On 7/1/22 18:11, Pavel Machek via libcamera-devel wrote:
>>> Hi!
>>>
>>>> Basic testing with cam utility
>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>
>>>> The ``cam`` utility can be used for basic testing. You can list the cameras
>>>> detected on the system with ``cam -l``, and capture ten frames from the first
>>>> camera and save them to disk with ``cam -c 1 --capture=10 --file``. See
>>>> ``cam -h`` for more information about the ``cam`` tool.
>>>
>>> Ok, so I have cam and qcam working, for example:
>>>
>>> [41:27:19.115361498] [79897]  INFO Camera camera.cpp:1029 configuring streams: (0) 1280x720-SBGGR8
>>>
>>> I even have YUYV8 working, at lower resolutions. Full resolution is
>>> not working for some reason. Anyway...
>>>
>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8)); // Has problems at resolutions < 1280x720
>>> +       if (code == MEDIA_BUS_FMT_YUYV8_2X8)
>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_YUYV)); // Has problems at resolutions > 1280x720
>>> +       if (code == MEDIA_BUS_FMT_UYVY8_2X8)
>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_YUV420)); // Causes assertion
>>> +       if (code == MEDIA_BUS_FMT_RGB565_2X8_LE)
>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_RGB565)); // no viewfinder available
>>> +       if (code == MEDIA_BUS_FMT_JPEG_1X8)
>>> +         formats.push_back(V4L2PixelFormat(V4L2_PIX_FMT_JPEG));  // No luck
>>>           return formats;
>>>
>>> I guess going with gstreamer framework is the next step.
>>>
>>> $ gst-launch-1.0 libcamerasrc  ! video/x-bayer,width=1280,height=720 !
>>> filesink location=/tmp/delme.unk ; ls -al /tmp/delme.unk
>>> WARNING: erroneous pipeline: could not link libcamerasrc0 to filesink0, libcamerasrc0 can't handle caps video/x-bayer, width=(int)1280, height=(int)720
>>>
>>> What's the problem with bayer? Camera supplies it, so libcamera should
>>> be able to supply it, too...?
>>>
>>> I tried to do:
>>>
>>> export GST_DEBUG=libcamera*:7
>>> export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer
>>>
>>> gst-launch-1.0 libcamerasrc camera-name=/base/i2c-csi/rear-camera at 4c ! video/x-raw,width=12\
>>> 80,height=720,format=YUYV,colorimetry=bt709,framerate=30/1 ! filesink location=/tmp/delme.u\
>>> nk ; ls -al /tmp/delme.unk
>>>
>>> I get: And I'm not sure how this is supposed to work.
>>> gstlibcamerasrc.cpp does not seem to pass requested
>>> width/height/pixelformat from gstreamer parameters to libcamera.
>>>
>>> [41:57:46.409580451] [80813]  WARN V4L2 v4l2_pixelformat.cpp:295 Unsupported V4L2 pixel format JPEG
>>> [41:57:46.409804919] [80813] ERROR V4L2 v4l2_subdevice.cpp:466 'ov5640 3-004c': Unable to set format on pad 0: Invalid argument 2592x1944 code 16385 colorspace 0
>>> [41:57:46.410829628] [80813] ERROR SimplePipeline simple.cpp:1268 Searching for device
>>> 0:00:07.442555063 80812   0x559321f600 INFO            libcamerasrc gstlibcamerasrc.cpp:240:gst_libcamera_src_open:<libcamerasrc0> Using camera '/base/i2c-csi/rear-camera at 4c'
>>> Pipeline is live and does not need PREROLL ...
>>> 0:00:07.444400306 80812   0x5593390c00 DEBUG           libcamerasrc gstlibcamerasrc.cpp:358:gst_libcamera_src_task_enter:<libcamerasrc0> Streaming thread has started
>>> Pipeline is PREROLLED ...
>>> Setting pipeline to PLAYING ...
>>> New clock: GstSystemClock
>>> 0:00:07.447466808 80812   0x5593390c00 WARN            libcamerasrc gstlibcamerasrc.cpp:474:gst_libcamera_src_task_enter:<libcamerasrc0> error: Internal data stream error.
>>> 0:00:07.447573438 80812   0x5593390c00 WARN            libcamerasrc gstlibcamerasrc.cpp:474:gst_libcamera_src_task_enter:<libcamerasrc0> error: streaming stopped, reason not-negotiated (-4)
>>> ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.
>>> Additional debug info:
>>> ../src/gstreamer/gstlibcamerasrc.cpp(474): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
>>> streaming stopped, reason not-negotiated (-4)
>>> Execution ended after 0:00:00.003048210
>>> Setting pipeline to NULL ...
>>> 0:00:07.448231257 80812   0x5593390c00 DEBUG           libcamerasrc gstlibcamerasrc.cpp:490:gst_libcamera_src_task_leave:<libcamerasrc0> Streaming thread is about to stop
>>> 0:00:07.448946661 80812   0x559321f600 DEBUG           libcamerasrc gstlibcamerasrc.cpp:508:gst_libcamera_src_close:<libcamerasrc0> Releasing resources
>>> Freeing pipeline ...
>>> -rw-r--r-- 1 mobian mobian 0 Jul  1 23:04 /tmp/delme.unk
>>> mobian at mobian:~/g/libcamera$
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220703/91bac200/attachment.sig>


More information about the libcamera-devel mailing list