No description
Find a file
Kieran Bingham 058f589ae3 libcamera v0.5.0
The abi-compliance-checker reports there are both ABI and API changes in this
release:

  Binary compatibility: 99%
  Source compatibility: 99.5%
  Total binary compatibility problems: 5, warnings: 1
  Total source compatibility problems: 6, warnings: 1

Substantially less than the previous release, and ultimately quite minor but
unfortunately there nonetheless and so the SONAME is updated to 0.5
accordingly. I do not anticipate anything there that cannot be solved for
applications without just a recompile. I had hoped to get a longer run for 0.4
series...

A full and detailed ABI report for those interested can always be generated
between any two versions with the internal tooling:

 "./utils/abi-compat.sh v0.4.0 v0.5.0"

Integration overview:

This release brings in 201 commits with a huge list of fixes and code clean up
which I'm very happy to see, including interesting fixes to the AGC and AWB
handling in libipa.

In regards to new features, libcamera-0.5 has aptly now got the core Raspberry
Pi 5 support merged!. There are still patches that are currently maintained by
Raspberry Pi for additional features, and while the transition to upstream
API's continue, but I think we're all happy to see this support getting in
directly, and Raspberry Pi continue to lead the way in upstream camera
development. I look forward to the kernel API's for streams being fully
utilised by the PiSP platform for upstream camera metadata handling. This
upcoming work is also supported by the CameraSensor factory and CameraSensorRaw
support that is now also merged in this release.

Further more in the platform support, the software_isp continues to be
developed and is now able to measure colour temperature, which will bring in
improvements for AWB, and a CCM can be applied while peforming debayering (at a
CPU cost) which will allow us to finally apply color tuning for sensors on
devices that need to fall back to the software ISP.

New sensor support seems fairly short in this release, with the IMX415 being
the prominent addition.

In libipa, and algorithm developments, along with many fixes and improvements
there is a substantial new feature that the Baysian AWB algorithm from
Raspberry Pi can now also be used on all libipa supported IPA modules, and has
shown good impovements for the RkISP1 supported devices.

There is minimal changes to the application support side, but it is notable
that now the Y444 format has been mapped to be usable by the gstreamer src
element. lc-compliance has seen some progress which I hope will bring this to
being a more central part of the test infrastructure.

The following commits in this release relate to either a bug fix or an
improvement to an existing commit.

 - DmaBufAllocator: Make DmaSyncer non-copyable
   - Fixes: 39482d59fe ("DmaBufAllocator: Add Dma Buffer synchronization function & helper class")
 - utils: codegen: controls.py: Fix missing direction error message
   - Fixes: 39fe4ad968 ("utils: codegen: controls.py: Parse direction information")
 - Thread: Fix setThreadAffinity race condition in start
   - Fixes: 4d9db06d66 ("libcamera: add method to set thread affinity")
 - meson: Don't override pipeline list when `auto` is selected
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=247
 - DmaBufAllocator: Avoid syncing with an invalid file descriptor
   - Fixes: 545046a41e ("DmaBufAllocator: Make DmaSyncer non-copyable")
 - controls: Introduce AEGC-related controls
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=42
 - Documentation: guides: application-developer: Fix variable shadowing
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=252
 - libcamera: pipeline: virtual: Fill buffer's metadata
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=245
 - ipa: rkisp1: agc: Fix build on debian 11 (gcc-9)
   - Fixes: ee918b370a ("ipa: rkisp1: agc: Initialize enum controls with a list of values")
 - ipa: rpi: Apply default ControlInfo values for sensor controls
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=253
 - ipa: rpi: Fix incorrect cast for ExposureTime ControlInfo
   - Fixes: bea2db5e61 ("ipa: rpi: Apply default ControlInfo values for sensor controls")
 - ipa: rkisp1: algorithms: agc: Fix whitespace
   - Fixes: 0e0e32b189 ("ipa: rkisp1: algorithms: agc: Check for correct stats type")
 - libcamera: pipeline: Fix LIBCAMERA_<NAME>_TUNING_FILE handling
   - Fixes: f5da05ed03 ("libcamera: pipeline: Move tuning file override handling to IPAProxy")
 - ipa: rkisp1: algorithms: awb: Fix AWB means vector order in RGB mode
   - Fixes: 29892f1c56 ("ipa: libipa: colour: Use the RGB class to model RGB values")
 - libipa: awb: Fix non-virtual destructor warning in AwbStats
   - Fixes: 6f663990a0 ("libipa: Add AWB algorithm base class")
 - ipa: rkisp1: Allow exposure time to be shorter than minimum frame duration limit
   - Fixes: f72c76eb6e ("rkisp1: Honor the FrameDurationLimits control")
 - ipa: libipa: Fix bug in ExposureModeHelper that leads to oscillations in AEGC
   - Fixes: 34c9ab6282 ("ipa: libipa: Add ExposureModeHelper")
 - libcamera: software_isp: Emit ispStatsReady only if IPA is running
   - Reported-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
 - libcamera: base: log: Fix uninitialized variable warning
   - Fixes: 8fa119e0b5 ("libcamera: base: log: Use `std::from_chars()`")
 - libcamera: media_object: Fix unnecessary copy
   - Fixes: 9490c664b5 ("libcamera: Add members to MediaEntity to support ancillary entities")
 - ipa: rkisp1: agc: Fix metering modes
   - Fixes: 4c5152843a ("ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance")
 - libcamera: software_isp: Reset stored exposure in black level
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=259
 - libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode` control setup
   - Fixes: bad8d591f8 ("libcamera: uvcvideo: Register ExposureTimeMode control")
 - libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode` control setting
   - Fixes: bad8d591f8 ("libcamera: uvcvideo: Register ExposureTimeMode control")
 - ipa: simple: Initialize ccmEnabled to false
   - Fixes: ac30686556 ("libcamera: software_isp: Track whether CCM is enabled")
 - gstreamer: Use `Control<>` objects when setting controls
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=261
 - gstreamer: Restore `AeEnable` control
   - Fixes: 187f2d537b ("gstreamer: Generate the new AEGC controls")
 - pipeline: rpi: Fix potential empty optional read
   - Fixes: 6c71ee1f15 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")

And the following updates have been made in this release, grouped by category:

core:
 - libcamera: virtual: Avoid some copies
 - libcamera: virtual: Query number of planes correctly
 - libcamera: virtual: Speed up test pattern animation
 - libcamera: camera_sensor_properties: Add delays for imx415
 - include: linux: Update headers for line-based embedded data support
 - include: linux: videodev2: Add generic line based pixel formats
 - libcamera: v4l2_subdevice: Add new metadata formats
 - libcamera: v4l2_videodevice: Update to the new kernel metadata API
 - libcamera: Add CameraSensor implementation for raw V4L2 sensors
 - libcamera: camera_sensor: Add support for embedded data
 - libcamera: base: Remove custom __nodiscard attribute
 - libcamera: Add missing <stdint.h> include to dma_buf_allocator.h
 - libcamera: include: Include missing stdint.h header
 - utils: codegen: controls.py: Fix missing direction error message
 - meson: Convert `v4l2` into a feature option
 - meson: Don't override pipeline list when `auto` is selected
 - libcamera: pipeline_handler: Enable silent configuration file lookup
 - libcamera: virtual: Install configuration file
 - libcamera: v4l2_subdevice: Work around false positive warning
 - libcamera: uvcvideo: Register ExposureTimeMode control
 - libcamera: camera: Pre-process AeEnable control
 - libcamera: base: object,thread: Disable copy/move
 - libcamera: matrix: Add read-only accessor to internal data
 - libcamera: log: Match whole category in LIBCAMERA_LOG_LEVELS
 - libcamera: Copy Vector class files from libipa
 - libcamera: Adapt Vector class to new location
 - libcamera: request: addBuffer(): Do fence check earlier
 - libcamera: Drop spurious colon after doxygen \todo directive
 - meson: Enable the -Wnon-virtual-dtor compiler option
 - libcamera: formatting: Avoid spaces in for loops without expression
 - libcamera: base: log: Remove move constructor
 - libcamera: base: log: Use `std::from_chars()`
 - libcamera: base: log: Remove `LogMessage::init()`
 - libcamera: base: log: Make `LogCategory::severity_` atomic
 - libcamera: base: log: Use `std::string_view` to avoid some copies
 - libcamera: base: log: Pass dynamic prefix through
 - libcamera: base: log: Protect log categories with lock
 - libcamera: base: log: Avoid manual `LogCategory` deletion
 - libcamera: meson: Fix libyuv detection
 - libcamera: base: thread: Support dispatching for a specific receiver
 - libcamera: base: log: Fix uninitialized variable warning
 - libcamera: base: signal: Drop pre-C++17 support
 - meson: Add libpisp.wrap
 - libcamera: media_object: Fix unnecessary copy
 - libcamera: ipa_manager: Store `IPAModule`s in `std::unique_ptr`
 - libcamera: base: mutex: Remove unnecessary constructors
 - libcamera: media_device: Ignore `lockf()` return value
 - libcamera: v4l2_videodevice: `lastUsedCounter_` need not be atomic
 - libcamera: camera: Ensure correct id maps are always set
 - libcamera: base: span: Explicitly default copy assignment
 - libcamera: controls: Check size of enum
 - libcamera: camera_manager: Do not emit signals while holding lock
 - libcamera: camera_manager: Simplify camera lookup
 - libcamera: camera_manager: Take camera id in `std::string_view`
 - libcamera: base: object: Forward arguments when invoking
 - libcamera: base: bound_method: Simplify `invokePack()`
 - libcamera: v4l2_device: add frame start event helpers
 - DmaBufAllocator: Make DmaSyncer non-copyable
 - Thread: Fix setThreadAffinity race condition in start
 - DmaBufAllocator: Avoid syncing with an invalid file descriptor
 - controls: Introduce AEGC-related controls
 - controls: Remove AeLocked
 - controls: Redefine AeEnable

ipa:
 - ipa: rpi: Add cam_helper for imx415
 - ipa: rpi: Add vc4 tuning files for imx415
 - ipa: rpi: Use r-value references in the set()/setLocked() functions
 - ipa: rpi: Add erase()/eraseLocked() to RPiController::Metadata
 - ipa: rpi: Add a HW property to determine if the data buffer is strided
 - ipa: rpi: Provide the camera helper with the hardware configuration
 - ipa: raspberry: Port to the new AEGC controls
 - ipa: rkisp1: Port to the new AEGC controls
 - ipa: rkisp1: agc: Report new AeEnable control as available
 - ipa: raspberry: Report new AeEnable control as available
 - ipa: libipa: lux: Fix indentation
 - ipa: rkisp1: agc: Initialize enum controls with a list of values
 - ipa: rkisp1: agc: Fix build on debian 11 (gcc-9)
 - ipa: rpi: Apply default ControlInfo values for sensor controls
 - ipa: Use Vector class from libcamera
 - libipa: Drop Vector class
 - ipa: rpi: Fix incorrect cast for ExposureTime ControlInfo
 - ipa: rkisp1: algorithms: agc: Fix whitespace
 - libipa: interpolator: Add accessor to internal data
 - libipa: pwl: Add clear() function
 - libipa: Add AWB algorithm base class
 - libipa: awb: Add helper functions for AWB mode support
 - libipa: Add grey world AWB algorithm
 - ipa: rkisp1: Move calculation of RGB means into own function
 - ipa: rkisp1: Use grey world algorithm from libipa
 - libipa: Add bayesian AWB algorithm
 - ipa: rkisp1: Add support for bayes AWB algorithm from libipa
 - ipa: rkisp1: awb: Apply gains based on default colour temperature on start
 - libipa: lux: Normalize referenceY to 1
 - libipa: awb_bayes: Add logging of value limits
 - libipa: awb_bayes: Remove overly verbose log messages
 - libipa: awb_bayes: Change the probabilities from log space to linear space
 - libipa: awb: Sort class member documentation according to header order
 - libipa: awb: Capitalize AWB
 - libipa: awb: Follow function names with '()' in doxygen documentation
 - libipa: awb: Standardize spelling on 'grey' world
 - libipa: awb: Replace reference to pipeline handle with IPA module
 - libipa: awb: Pass lux value to calculateAwb() as unsigned int
 - ipa: rkisp1: awb: Fix wrong indentation in comment
 - libipa: awb: Rename AwbStats::getRGBMeans() to rgbMeans()
 - libipa: awb: Tidy up includes
 - libipa: awb_grey: Minor comment fixes
 - ipa: rkisp1: awb: Don't calculate RGB means if stats are missing
 - ipa: rkisp1: awb: Capitalize AWB
 - ipa: rkisp1: algorithms: awb: Fix AWB means vector order in RGB mode
 - libipa: awb: Fix non-virtual destructor warning in AwbStats
 - ipa: rkisp1: Initialise AGC from FrameDurationLimits controls
 - ipa: rkisp1: Alias lineDuration
 - ipa: rkisp1: Allow exposure time to be shorter than minimum frame duration limit
 - ipa: libipa: Fix bug in ExposureModeHelper that leads to oscillations in AEGC
 - utils: ipc: Only dispatch messages for proxy when stopping thread
 - ipa: rpi: Add support for Raspberry Pi 5
 - ipa: simple: lut: Fix include path
 - ipa: rkisp1: agc: Fix metering modes
 - ipa: rkisp1: agc: Set measurement window to full frame
 - ipa: rkisp1: Add debug log for the sensor controls being set
 - ipa: libipa: agc_mean_luminance: Error out when effectiveExposureValue is zero
 - ipa: rksip1: Remove setControls(0) to reduce startup oscillations
 - ipa: simple: softisp: Extend to pass metadata
 - ipa: simple: Report the ColourGains in metadata
 - ipa: simple: Report black levels in metadata
 - ipa: simple: Report contrast in metadata
 - ipa: simple: Report exposure in metadata
 - ipa: simple: Initialize ccmEnabled to false
 - libipa: histogram: Fix quantile() calculation for fractional results
 - libipa: histogram: Fix interQuantileMean() for small ranges

apps:
 - gstreamer: allocator: gst_libcamera_allocator_new(): Recognize errors
 - gstreamer: allocator: gst_libcamera_allocator_new(): Fix memory leak
 - gstreamer: Generate the new AEGC controls
 - apps: ppm_writer: Add a missing include
 - apps: ppm_writer: Return EIO on I/O errors
 - gstreamer: Fix scaler-crop property get
 - apps: common: event_loop: Take callbacks by rvalue ref
 - apps: common: event_loop: Disable copy/move
 - apps: common: event_loop: Use `std::deque` instead of `std::list`
 - apps: common: event_loop: Use single event source for deferred calls
 - apps: common: event_loop: Remove unused type alias
 - apps: lc-compliance: Initialize `CameraManager` pointer in `Environment`
 - apps: lc-compliance: Put tests into anonymous namespace
 - apps: lc-compliance: Optimize `std::shared_ptr` usage
 - apps: lc-compliance: Remove redundant getter call
 - apps: lc-compliance: Don't allocate `FrameBufferAllocator` dynamically
 - apps: lc-compliance: Use `std::vector` for argument array
 - apps: lc-compliance: Use array instead of `std::vector`
 - apps: lc-compliance: Add message to `GTEST_SKIP()`
 - apps: lc-compliance: Merge `CaptureBalanced` and `CaptureUnbalanced`
 - gstreamer: Add Y444 format support to the YUV list
 - apps: cam: Fix include order
 - apps: qcam: Simplify `PixelFormat` search
 - apps: cam: Highlight default enumerator
 - gstreamer: Use `Control<>` objects when setting controls
 - gstreamer: Restore `AeEnable` control

pipeline:
 - libcamera: pipeline: virtual: Demote config file error message to debug
 - libcamera: pipeline: Move tuning file override handling to IPAProxy
 - libcamera: software_isp: Move a non-loop condition out of the loop
 - libcamera: software_isp: Handle signals in the proper thread
 - libcamera: pipeline: virtual: Simplify error return
 - libcamera: pipeline: virtual: Fill buffer's metadata
 - libcamera: pipeline: virtual: Set `FrameError` on error
 - libcamera: pipeline: Fix LIBCAMERA_<NAME>_TUNING_FILE handling
 - rkisp1: Honor the FrameDurationLimits control
 - libcamera: software_isp: Emit ispStatsReady only if IPA is running
 - libcamera: software_isp: Handle queued output buffers on stop
 - libcamera: software_isp: Handle queued input buffers on stop
 - libcamera: software_isp: Dispatch messages on stop
 - pipeline: rpi: Add new stream flags for PiSP
 - pipeline: rpi: Add support for Raspberry Pi 5
 - libcamera: software_isp: Determine color temperature
 - libcamera: software_isp: Use RGB type to represent gains
 - libcamera: software_isp: Store color temperature to metadata
 - libcamera: software_isp: lut: Remove maybe_unused on a used argument
 - libcamera: software_isp: Use common code to store debayered pixels
 - libcamera: software_isp: Use a macro to assign debayering methods
 - libcamera: software_isp: Add CCM algorithm
 - libcamera: software_isp: Add an example CCM to uncalibrated.yaml
 - libcamera: software_isp: Track whether CCM is enabled
 - libcamera: software_isp: Apply CCM in debayering
 - pipeline: rpi: pisp: Fix uninitialized variable warning
 - libcamera: software_isp: Track frames and requests
 - libcamera: software_isp: Reset stored exposure in black level
 - libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode` control setup
 - libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode` control setting
 - pipeline: rpi: Fix potential empty optional read
 - pipeline: simple: Connect/disconnect frameStart signal at start/stop time
 - pipeline: simple: Enable frame start events
 - pipeline: simple: Create DelayedControls instance once only
 - pipeline: simple: Reset delayedCtrls at start

documentation:
 - Documentation: design: ae: Document the design for AE controls
 - Documentation: guides: application-developer: Fix variable shadowing
 - Revert "README.rst: Report py dependencies"

test:
 - test: ipa_data_serialization: Use DebugMetadataEnable
 - test: threads: Use `pthread_testcancel()`
 - test: ipa: libipa: Add histogram tests
 - test: ipa: libipa: histogram: Add tests for quantile() returning a fraction
 - test: ipa: libipa: histogram: Add tests for small inter quantile mean ranges

tuning:
 - libtuning: module: awb: Add bayes AWB support
 - libtuning: Add module for lux calibration
 - utils: tuning: rkisp1: Add lux module

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-04-03 14:38:25 +01:00
.reuse Documentation: Introduce Camera Sensor Model 2023-09-27 14:35:33 +03:00
Documentation pipeline: rpi: Add support for Raspberry Pi 5 2025-03-20 12:03:28 +00:00
include libcamera: v4l2_device: add frame start event helpers 2025-04-03 09:36:11 +01:00
LICENSES Documentation: theme: Specify license of search.png 2022-09-30 21:51:14 +03:00
package/gentoo/media-libs/libcamera libcamera: Standardize URLs to git repositories 2021-09-24 13:25:33 +03:00
src libipa: histogram: Fix interQuantileMean() for small ranges 2025-04-03 12:36:07 +02:00
subprojects meson: Add libpisp.wrap 2025-03-20 12:00:03 +00:00
test libipa: histogram: Fix interQuantileMean() for small ranges 2025-04-03 12:36:07 +02:00
utils gstreamer: Restore AeEnable control 2025-04-02 17:41:14 +02:00
.clang-format libcamera: Remove spaces at end of lines 2024-08-05 18:25:53 +03:00
.clang-tidy libcamera: Add missing SPDX headers for miscellaneous CC0-1.0 contents 2022-09-30 21:51:23 +03:00
.editorconfig Add .editorconfig file 2024-11-19 23:57:09 +00:00
.gitignore gitignore: Add venv directory to gitignore 2024-10-09 14:36:47 +02:00
COPYING.rst libcamera: Summarize licensing terms in COPYING.rst 2020-06-26 15:18:25 +03:00
meson.build libcamera v0.5.0 2025-04-03 14:38:25 +01:00
meson_options.txt pipeline: rpi: Add support for Raspberry Pi 5 2025-03-20 12:03:28 +00:00
README.rst Revert "README.rst: Report py dependencies" 2025-03-04 18:02:14 +01:00

.. SPDX-License-Identifier: CC-BY-SA-4.0

===========
 libcamera
===========

**A complex camera support library for Linux, Android, and ChromeOS**

Cameras are complex devices that need heavy hardware image processing
operations. Control of the processing is based on advanced algorithms that must
run on a programmable processor. This has traditionally been implemented in a
dedicated MCU in the camera, but in embedded devices algorithms have been moved
to the main CPU to save cost. Blurring the boundary between camera devices and
Linux often left the user with no other option than a vendor-specific
closed-source solution.

To address this problem the Linux media community has very recently started
collaboration with the industry to develop a camera stack that will be
open-source-friendly while still protecting vendor core IP. libcamera was born
out of that collaboration and will offer modern camera support to Linux-based
systems, including traditional Linux distributions, ChromeOS and Android.

.. section-begin-getting-started

Getting Started
---------------

To fetch the sources, build and install:

.. code::

  git clone https://git.libcamera.org/libcamera/libcamera.git
  cd libcamera
  meson setup build
  ninja -C build install

Dependencies
~~~~~~~~~~~~

The following Debian/Ubuntu packages are required for building libcamera.
Other distributions may have differing package names:

A C++ toolchain: [required]
        Either {g++, clang}

Meson Build system: [required]
        meson (>= 0.60) ninja-build pkg-config

for the libcamera core: [required]
        libyaml-dev python3-yaml python3-ply python3-jinja2

for IPA module signing: [recommended]
        Either libgnutls28-dev or libssl-dev, openssl

        Without IPA module signing, all IPA modules will be isolated in a
        separate process. This adds an unnecessary extra overhead at runtime.

for improved debugging: [optional]
        libdw-dev libunwind-dev

        libdw and libunwind provide backtraces to help debugging assertion
        failures. Their functions overlap, libdw provides the most detailed
        information, and libunwind is not needed if both libdw and the glibc
        backtrace() function are available.

for device hotplug enumeration: [optional]
        libudev-dev

for documentation: [optional]
        python3-sphinx doxygen graphviz texlive-latex-extra

for gstreamer: [optional]
        libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

for Python bindings: [optional]
        libpython3-dev pybind11-dev

for cam: [optional]
        libevent-dev is required to support cam, however the following
        optional dependencies bring more functionality to the cam test
        tool:

        - libdrm-dev: Enables the KMS sink
        - libjpeg-dev: Enables MJPEG on the SDL sink
        - libsdl2-dev: Enables the SDL sink

for qcam: [optional]
        libtiff-dev qt6-base-dev qt6-tools-dev-tools

for tracing with lttng: [optional]
        liblttng-ust-dev python3-jinja2 lttng-tools

for android: [optional]
        libexif-dev libjpeg-dev

for lc-compliance: [optional]
        libevent-dev libgtest-dev

for abi-compat.sh: [optional]
        abi-compliance-checker

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.

In case of problems, a detailed debug log can be obtained from libcamera by
setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:

.. code::

    :~$ LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l

Using GStreamer plugin
~~~~~~~~~~~~~~~~~~~~~~

To use the GStreamer plugin from the source tree, use the meson ``devenv``
command.  This will create a new shell instance with the ``GST_PLUGIN_PATH``
environment set accordingly.

.. code::

  meson devenv -C build

The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
test it. The following pipeline will stream from the camera named "Camera 1"
onto the OpenGL accelerated display element on your system.

.. code::

  gst-launch-1.0 libcamerasrc camera-name="Camera 1" ! queue ! glimagesink

To show the first camera found you can omit the camera-name property, or you
can list the cameras and their capabilities using:

.. code::

  gst-device-monitor-1.0 Video

This will also show the supported stream sizes which can be manually selected
if desired with a pipeline such as:

.. code::

  gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=1280,height=720' ! \
       queue ! glimagesink

The libcamerasrc element has two log categories, named libcamera-provider (for
the video device provider) and libcamerasrc (for the operation of the camera).
All corresponding debug messages can be enabled by setting the ``GST_DEBUG``
environment variable to ``libcamera*:7``.

Presently, to prevent element negotiation failures it is required to specify
the colorimetry and framerate as part of your pipeline construction. For
instance, to capture and encode as a JPEG stream and receive on another device
the following example could be used as a starting point:

.. code::

   gst-launch-1.0 libcamerasrc ! \
        video/x-raw,colorimetry=bt709,format=NV12,width=1280,height=720,framerate=30/1 ! \
        queue ! jpegenc ! multipartmux ! \
        tcpserversink host=0.0.0.0 port=5000

Which can be received on another device over the network with:

.. code::

   gst-launch-1.0 tcpclientsrc host=$DEVICE_IP port=5000 ! \
        multipartdemux ! jpegdec ! autovideosink

The GStreamer element also supports multiple streams. This is achieved by
requesting additional source pads. Downstream caps filters can be used
to choose specific parameters like resolution and pixel format. The pad
property ``stream-role`` can be used to select a role.

The following example displays a 640x480 view finder while streaming JPEG
encoded 800x600 video. You can use the receiver pipeline above to view the
remote stream from another device.

.. code::

   gst-launch-1.0 libcamerasrc name=cs src::stream-role=view-finder src_0::stream-role=video-recording \
       cs.src ! queue ! video/x-raw,width=640,height=480 ! videoconvert ! autovideosink \
       cs.src_0 ! queue ! video/x-raw,width=800,height=600 ! videoconvert ! \
       jpegenc ! multipartmux ! tcpserversink host=0.0.0.0 port=5000

.. section-end-getting-started

Troubleshooting
~~~~~~~~~~~~~~~

Several users have reported issues with meson installation, crux of the issue
is a potential version mismatch between the version that root uses, and the
version that the normal user uses. On calling `ninja -C build`, it can't find
the build.ninja module. This is a snippet of the error message.

::

  ninja: Entering directory `build'
  ninja: error: loading 'build.ninja': No such file or directory

This can be solved in two ways:

1. Don't install meson again if it is already installed system-wide.

2. If a version of meson which is different from the system-wide version is
   already installed, uninstall that meson using pip3, and install again without
   the --user argument.