GStreamer libcamerasrc Cannot Find Camera, but Picamera2 Works

I’m working on a Pi 5 with a Hailo-8 AI accelerator and trying to use GStreamer to capture video from my camera. However, I’m getting the following error when running:

gst-launch-1.0 -v \
    libcamerasrc camera-name="imx708_wide" ! video/x-raw, format=RGB, width=640, height=640 ! \
    queue ! videoscale ! videoconvert ! \
    hailonet hef-path=/home/typeadmin/hailo-rpi5-examples/resources/yolov8m.hef ! \
    hailofilter ! hailooverlay ! videoconvert ! \
    x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=8554 sync=true

Error Message:

ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Could not find a camera named 'imx708_wide'.
Additional debug info:
../src/gstreamer/gstlibcamerasrc.cpp(394): gst_libcamera_src_open (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
libcamera::CameraMananger::get() returned nullptr
ERROR: pipeline doesn't want to preroll.

What Works:

:white_check_mark: Running detection.py -i rpi works fine
:white_check_mark: Running libcamera-hello --list-cameras detects the camera correctly

What I’ve Tried:

1.Verified Camera Name:

  • libcamera-hello --list-cameras returns:
Available cameras:
0 : imx708_wide (Sony IMX708)
  • Used "imx708_wide" in the GStreamer pipeline, but the error persists.
  1. Checked if libcamerasrc Exists in GStreamer:
  • gst-inspect-1.0 libcamerasrc confirms that libcamerasrc is available.
  1. Checked if the Camera is Busy:
  • Ran sudo lsof | grep /dev/video, and it seems like Picamera2 is using the camera.
  1. Tried Using v4l2src Instead of libcamerasrc:
gst-launch-1.0 -v v4l2src device=/dev/video0 ! videoconvert ! autovideosink
  • Fails with the same error.
  1. Tried Stopping Picamera2 Before Running GStreamer:
sudo pkill -f picamera2
  • Still, libcamerasrc cannot find the camera.

Hey @Dan_C ,

Does this issue still persist after the update?

Hi,
just a guess. Do not only use

libcamerasrc camera-name="imx708_wide"

instead

libcamerasrc **name=DEV_PATH_TO_CAM** camera-name="imx708_wide"

where DEV_PATH_TO_CAM is the device path from

Preformatted textlibcamera-hello --list-cameras

For me also on a rpi5 with cameraHQ (imx477) it looks like:
libcamerasrc name= /base/axi/pcie@120000/rp1/i2c@88000/ camera-name=…

rpicam-hello --list
Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@120000/rp1/i2c@88000/imx477@1a)
    ...

Sorry, can’t edit my post.
For me it looks like this. Take the device Path, not the name.
libcamerasrc camera-name=“/base/axi/pcie@120000/rp1/i2c@88000/imx477@1a”

Hi,

I actually tried that too. Yea, it still persists . I’ve even rebuilt the pi and started over. If it’d useful, I’ll happily rebuilt again and share my command history

For reference , when I use the full dev path, I get the same error. It’s very strange. Well it is to me :slight_smile:

If you want to share the script i would test and give you feedback.

how do you call the gstreamer script? Also with -i rpi ?

(venv_hailo_rpi5_examples) user@raspi:~/Pose-dir $ 
python pose714.py -i rpi 

Select a camera:

   Camera 1         /base/axi/pcie@120000/rp1/i2c@88000/imx477@1a
   Camera 2         /base/axi/pcie@120000/rp1/i2c@80000/imx477@1a

Enter the camera number: 1
Selected camera: Camera 1

hailomuxer name=hmux libcamerasrc name=Camera0 camera-name=/base/axi/pcie@120000/rp1/i2c@88000/imx477@1a  ! video/x-raw, format=RGB, width=1536, height=864 ! queue name=queue_src_scale max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! videoscale ! video/x-raw, format=RGB, width=640, height=640, framerate=30/1 ! queue name=queue_scale max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! videoscale n-threads=2 ! queue name=queue_src_convert max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=2 name=src_convert qos=false ! video/x-raw, format=RGB, width=640, height=640, pixel-aspect-ratio=1/1 ! tee name=t ! queue name=bypass_queue max-size-buffers=20 max-size-bytes=0 max-size-time=0 ! hmux.sink_0 t. ! queue name=queue_hailonet max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=2 ! hailonet hef-path=/home/admin/Pose-Based_Light_Control_with_Node-Red_and_Raspberry_Pi_with_AIkit/./hailomodel/yolov8s_pose_h8l_pi.hef batch-size=2 force-writable=true ! queue name=queue_hailofilter max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! hailofilter function-name=filter so-path=/usr/lib/aarch64-linux-gnu/hailo/tappas/post_processes/libyolov8pose_post.so qos=false ! queue name=queue_hmuc max-size-buffers=100 max-size-bytes=0 max-size-time=0 !  hmux.sink_1 hmux. ! queue name=queue_hailo_python max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! queue name=queue_user_callback max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! identity name=identity_callback ! queue name=queue_hailooverlay max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! hailooverlay ! queue name=queue_videoconvert max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=2 qos=false ! queue name=queue_hailo_display max-size-buffers=100 max-size-bytes=0 max-size-time=0 ! videoconvert ! fpsdisplaysink video-sink=xvimagesink name=hailo_display sync=false signal-fps-measurements=true 
[0:47:15.308914869] [12021]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679
[0:47:15.319684942] [12054]  INFO RPI pisp.cpp:720 libpisp version v1.1.0 e7974a156008 27-01-2025 (21:50:51)
[0:47:15.329279988] [12054]  INFO RPI pisp.cpp:1179 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/imx477@1a to CFE device /dev/media3 and ISP device /dev/media0 using PiSP variant BCM2712_C0
[0:47:15.329356692] [12054]  INFO RPI pisp.cpp:720 libpisp version v1.1.0 e7974a156008 27-01-2025 (21:50:51)
[0:47:15.338607310] [12054]  INFO RPI pisp.cpp:1179 Registered camera /base/axi/pcie@120000/rp1/i2c@80000/imx477@1a to CFE device /dev/media4 and ISP device /dev/media1 using PiSP variant BCM2712_C0
[0:47:15.350766317] [12071]  INFO Camera camera.cpp:1202 configuring streams: (0) 1536x864-BGR888
[0:47:15.350931467] [12054]  INFO RPI pisp.cpp:1484 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected CFE format: 2028x1080-PC1B

Hi,

Sorry I haven’t got back to you yet, let me find the time today and make this happen. Just away from my desk, again :frowning:

Hailo RPI5 Examples Setup & Issues

Initial Setup & Firmware Identification

sudo raspi-config
sudo apt update && sudo apt full-upgrade
sudo apt install hailo-all
sudo reboot
hailortcli fw-control identify

Executing on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.20.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8
Serial Number: <N/A>
Part Number: <N/A>

Cloning the Repository & Installing Examples

git clone https://github.com/hailo-ai/hailo-rpi5-examples.git
cd hailo-rpi5-examples

./install.sh


--- 
    Error: Meson is not installed.

Next Steps

sudo apt-get install meson

./install.sh
source setup_env.sh

Then

python basic_pipelines/detection.py --input rpi

Issue: Picamera2 Not Defined

 File "/home/typeadmin/hailo-rpi5-examples/venv_hailo_rpi5_examples/lib/python3.11/site-packages/hailo_apps_infra/gstreamer_app.py", line 263, in picamera_thread
    with Picamera2() as picam2:
         ^^^^^^^^^
NameError: name 'Picamera2' is not defined

Solution

sudo apt install python3-picamera2 --no-install-recommends

Picamera2 is only supported on Raspberry Pi OS Bullseye (or later) images, both 32 and 64-bit. As of September 2022, Picamera2 is pre-installed on Raspberry Pi OS images, but not on Raspberry Pi OS Lite images. It works on all Raspberry Pi boards right down to the Pi Zero, although performance in some areas may be worse on less powerful devices."

Then try again:

python basic_pipelines/detection.py --input rpi
GStreamer Pipeline Issues with x264enc
gst-launch-1.0 -v \
    libcamerasrc camera-name="imx708_wide" ! video/x-raw, format=RGB, width=640, height=640 ! \
    queue ! videoscale ! videoconvert ! \
    hailonet hef-path=/home/typeadmin/hailo-rpi5-examples/resources/yolov8m.hef ! \
    hailofilter ! hailooverlay ! videoconvert ! \
    x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=8554 sync=true

Error:

WARNING: erroneous pipeline: no element "x264enc"
gstreamer1.0-plugins-ugly

Further testing

gst-launch-1.0 -v \
    libcamerasrc camera-name="imx708_wide" ! video/x-raw, format=RGB, width=640, height=640 ! \
    queue ! videoscale ! videoconvert ! \
    hailonet hef-path=/home/typeadmin/hailo-rpi5-examples/resources/yolov8m.hef ! \
    hailofilter ! hailooverlay ! videoconvert ! \
    x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=8554 sync=true

Output

[26:17:04.043300995] [3321]  INFO RPI pisp.cpp:1179 Registered camera /base/axi/pcie@120000/rp1/i2c@80000/imx708@1a to CFE device /dev/media4 and ISP device /dev/media2 using PiSP variant BCM2712_C0
ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Could not find a camera named 'imx708_wide'.

Attempting with camera path

ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Could not find a camera named ' /base/axi/pcie@120000/rp1/i2c@80000/imx708@1a'.

Rpicam-hello --list

Available cameras
-----------------
0 : imx708_wide_noir [4608x2592 10-bit RGGB] (/base/axi/pcie@120000/rp1/i2c@88000/imx708@1a)
    Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
                             2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
                             4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]

1 : imx708_wide [4608x2592 10-bit RGGB] (/base/axi/pcie@120000/rp1/i2c@80000/imx708@1a)
    Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
                             2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
                             4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]

I think that’s everything, I wont be suprised if its me doing something really silly, it’s all new to me!

Thank you,

Hey Dan,

with slightly modifications your code started on my system:

$ cd hailo-rpi5-examples
$ .  setup_env.sh
gst-launch-1.0 -v \
    libcamerasrc name=/base/axi/pcie@120000/rp1/i2c@88000/imx477@1a ! video/x-raw, format=RGB, width=1536, height=864 ! \
    queue ! videoscale ! videoconvert ! \
    hailonet hef-path=/home/admin/hailo-rpi5-examples/resources/yolov8s_h8l.hef ! \
    hailofilter ! hailooverlay ! videoconvert ! \
    x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=8554 sync=true