Raghavendra Rao
September 11, 2020
Earlier this year, my colleagues Julian Bouzas and George Kiagiadakis wrote about PipeWire and Wireplumber, the PipeWire session manager. Since then, PipeWire has continued to evolve with the recent integration of libcamera, a library to support complex cameras. In this blog post, I'll explain why libcamera exists, what it does, and how we integrated it in PipeWire.
Cameras are complex devices which require heavy hardware image processing. The complexity in the userspace camera application development originates with the evolution of complex hardware. libcamera addresses this problem and offers ease of camera application development. libcamera can be described as a full camera stack library in the userspace to provide the feature that do not belong in the kernel.
The core of libcamera framework exposes kernel driver APIs to userspace while the libcamera application layer abstracts the developer from complex hardware usage. libcamera supports multiple video streams from a single device. In real time use cases such as video conferencing, we may need to preview streams with different resolutions than what we tend to stream over the network. It is natural that we would like to display the live streaming simaultaneously while we capture the video with different resolutions. libcamera offers a perfect solution to fulfill these requirements.
Having said that, what if we'd like to stream a camera device data using different applications simaultaneously? Well, PipeWire answers this question. Besides acting as an interface between hardware devices and applications, PipeWire eases the sharing of hardware devices between applications. Moreover, integration of libcamera into PipeWire brings all the abilities offered by libcamera into PipeWire. With this, PipeWire can become a first class user of modern cameras.
As camera application development through v4l becomes more and more complex, Collabora decided to tackle this by integrating libcamera into PipeWire to offer all the evolutions coming from both the frameworks.
The integration work has been merged into PipeWire master.
Please follow the steps below to try libcamera in PipeWire.
sudo adduser `whoami` video
and restart the session.meson --prefix <path/to/install dir> --buildtype=plain build cd build ninja -C . install
meson --prefix <path/to/install dir> -Dlibcamera=true build cd build ninja -C . install
We will be blogging more about this integration work and improvements to be made in the future, explaining the motivation and further progress we make. Stay tuned!
03/03/2021
In the embedded world, many modern SoCs such as the ST Microelectronics STM32MP1 now include coprocessor cores which can be used for a wide…
17/02/2021
Our recent efforts on the Hantro kernel driver have resulted in the addition of H.264 decoding support and multiple performance improvements.…
08/02/2021
Hwangsaeul, or H8L, a remote surveillance streaming solution, utilizes the capability of libsrt to collect statistics from open SRT sockets…
01/02/2021
Complex, real-world correctness tests and performance analysis are now possible thanks to gltrim, a new tool recently added to apitrace,…
28/01/2021
Earlier this week, WebRTC became an official W3C and IETF standard. GStreamer has a powerful and rapidly maturing WebRTC implementation.…
21/01/2021
Last year, from June to September, I worked on the kernel development tool Coccinelle under Collabora. I implemented a performance boosting…
Comments (4)
Rogan Dawes:
Sep 14, 2020 at 05:04 PM
Is this something that could easily be exported as a remote desktop using VNC? Given the availability of cheap HDMI input dongles that appear as a UVC camera, it would be neat to be able to expose them using a regular "remote desktop" protocol. I guess an input filter would be required to receive the keystrokes and mouse movements, of course. Those could then be emitted using a HID Gadget and ConfigFS or similar.
I did look at doing this with Xvncserver, but the rawfb support was a bit tricky to figure out, and I never got that working.
Reply to this comment
Reply to this comment
Raghavendra:
Sep 15, 2020 at 06:57 PM
Hello Rogan Dawes,
Thank you for your response.
The idea behind the integration of libcamera was to ease the Camera application development with modern cameras and bring all the capabilities of libcamera to PipeWire.
It is interesting to note that PipeWire already supports remote desktop sharing with wayland, gnome-remote-desktop and browsers such as firefox, chrome etc. PipeWire acts as interface between the Application and hardware to share the media via "dmabuf" buffers. Applications such as VNC/RDP can connect to PipeWire creating sink nodes to consume the Video frames captured by source nodes such as libcamera node, in this case.
gnome-remote-desktop daemon enables GNOME to offer remote desktop sharing using VNC with PipeWire. This daemon supports GNOME on X as well as GNOME on Wayland. If you have got ubuntu installed then you may want to recompile mutter with remote desktop option enabled to make it work on ubuntu.
Thanks,
Raghavendra
Reply to this comment
Reply to this comment
Andrew Zhukov:
Jan 26, 2021 at 12:57 PM
Can't get it work with latest libcamera and pipewire. Seems like pipewire uses old libcamera version...
Reply to this comment
Reply to this comment
Raghavendra Rao:
Feb 03, 2021 at 11:48 AM
Hello Andrew Zhukov,
Thanks for your message.
The issue has been fixed and the fix has been merged into pipewire master. You can now check with pipewire master branch,
Thanks,
Raghavendra Rao
Reply to this comment
Reply to this comment
Add a Comment