[libcamera-devel] libcamera on pinephone

Pavel Machek pavel at ucw.cz
Fri Jul 1 23:11:20 CEST 2022


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$ 

Best regards,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220701/b63db8c8/attachment.sig>


More information about the libcamera-devel mailing list