agherzan / meta-raspberrypi

Yocto/OE BSP layer for the Raspberry Pi boards
https://www.yoctoproject.org/
MIT License
505 stars 395 forks source link

libcamera-apps libcamera-vid cannot record video #1331

Open IvanVeloz opened 1 month ago

IvanVeloz commented 1 month ago

On the nanbield branch, libcamera-vid cannot record video. The error below is displayed:

root@ac-cloudifier:~# libcamera-vid -t 10 -o test.h264
ERROR: *** Invalid time string provided ***

I traced this error down to core/options.hpp in libcamera-apps (please note that libcamera-apps has been renamed to rpicam-apps by the Raspberry Pi Foundation, but this is a separate issue that does not affect the recipe as of today). I could not trace it down further because I have a tight deadline for this project, but as far as I can tell, it's an upstream bug.

The recipe is using v1.2.1, specifically, SRCREV = "1c1d1c1a2a86d70cf873edc8bb72d174f037973a". By staying in v1.2.1, but changing the SRCREV to a more updated SRCREV = "7e4d3d71867f60f5398687180972798baad85f1b", I got it to work as expected.

Steps to reproduce the issue:

  1. Create a build an image with the libcamera-apps recipe, and camera support in config.txt, such as
    VIDEO_CAMERA = "1"
    RASPBERRYPI_CAMERA_V3 = "1"
  2. Flash said image on real hardware.
  3. Attempt to capture video using libcamera-vid -t 10 -o test.h264 for example.

Describe the results you received:

root@ac-cloudifier:~# libcamera-vid -t 10 -o test.h264
ERROR: *** Invalid time string provided ***

Describe the results you expected:

root@ac-cloudifier:~# libcamera-vid -t 10 -o test.h264
Made DRM preview window
[0:01:21.552803709] [426]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+19-960d0c1e-dirty (2024-05-29T14:53:16+00:00)
[0:01:21.676063855] [427]  WARN CameraSensorProperties camera_sensor_properties.cpp:249 No static properties available for 'imx708_noir'
[0:01:21.676206619] [427]  WARN CameraSensorProperties camera_sensor_properties.cpp:251 Please consider updating the camera sensor properties database
[0:01:21.913261351] [427]  INFO RPI vc4.cpp:390 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media1 and ISP device /dev/media0
[0:01:21.920267420] [426]  INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-YUV420
[0:01:21.923125515] [427]  INFO RPI vc4.cpp:512 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
Halting: reached timeout of 10 milliseconds.
root@ac-cloudifier:~# libcamera-vid -t 10000 -o test.h264
Made DRM preview window
[0:01:28.809728648] [435]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+19-960d0c1e-dirty (2024-05-29T14:53:16+00:00)
[0:01:28.931590466] [436]  WARN CameraSensorProperties camera_sensor_properties.cpp:249 No static properties available for 'imx708_noir'
[0:01:28.931727187] [436]  WARN CameraSensorProperties camera_sensor_properties.cpp:251 Please consider updating the camera sensor properties database
[0:01:29.140755869] [436]  INFO RPI vc4.cpp:390 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media1 and ISP device /dev/media0
[0:01:29.147198945] [435]  INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-YUV420
[0:01:29.149850187] [436]  INFO RPI vc4.cpp:512 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
Halting: reached timeout of 10000 milliseconds.

Additional information you deem important (e.g. issue happens only occasionally): The libcamera-apps repository is being renamed to rpicam-apps. This change needs to be considered in the near future, as the repo URL is also changing. Right now, both the old URL (github.com/raspberrypi/libcamera-apps) and the new one (github.com/raspberrypi/rpicam-apps) are up. See the readme.

Additional details (revisions used, host distro, etc.): Used Raspberry Pi Camera Module 3 NoIR, Raspberry Pi Zero 2 W, host bistro is Ubuntu focal. Layers:

layer                 path                                                                    priority
========================================================================================================
core                  /home/ivan/ac-cloudifier-yocto/poky/meta                                5
yocto                 /home/ivan/ac-cloudifier-yocto/poky/meta-poky                           5
yoctobsp              /home/ivan/ac-cloudifier-yocto/poky/meta-yocto-bsp                      5
raspberrypi           /home/ivan/ac-cloudifier-yocto/meta-raspberrypi                         9
openembedded-layer    /home/ivan/ac-cloudifier-yocto/meta-openembedded/meta-oe                5
meta-python           /home/ivan/ac-cloudifier-yocto/meta-openembedded/meta-python            5
networking-layer      /home/ivan/ac-cloudifier-yocto/meta-openembedded/meta-networking        5
meta-aesd             /home/ivan/ac-cloudifier-yocto/meta-aesd                                6
multimedia-layer      /home/ivan/ac-cloudifier-yocto/meta-openembedded/meta-multimedia        5
workspacelayer        /home/ivan/ac-cloudifier-yocto/rpi-build-nanbield/workspace             99

The meta-aesd layer contains this attached append file, which fixed the issue for me (I did not need to change file://0001-utils-version.py-use-usr-bin-env-in-shebang.patch). meta-aesd/recipes-libcamera-apps/libcamera-apps/libcamera-apps_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI = "\
    git://github.com/raspberrypi/libcamera-apps.git;protocol=https;branch=main \
    file://0001-utils-version.py-use-usr-bin-env-in-shebang.patch \
"
PV = "1.2.1+git${SRCPV}"
SRCREV = "7e4d3d71867f60f5398687180972798baad85f1b"