Where did you get the camera module(s)?
Kickstarter
Model number of the product(s)?
N/A
What hardware/platform were you working on?
Raspberry Pi Zero 2 W
Instructions you have followed. (link/manual/etc.)
I followed all instructions regarding the installation of the module. Tests with libcamera-still and libcamera-vid are successful.
Problems you were having?
I can’t get ffmpeg to record video. I tried using /dev/video0 with v4l2 but had no success. In the most simple form, the record command looks like this:
In dmesg I get the following entry every time I try to start ffmpeg:
unicam 3f801000.csi: Failed to start media pipeline: -22
The dmesg log from your hardware?
imx519 10-001a: Device found is imx519
imx519 10-001a: Consider updating driver imx519 to match on endpoints
and in case of an ffmpeg start:
unicam 3f801000.csi: Failed to start media pipeline: -22
Troubleshooting attempts you’ve made?
I tried all sorts of additional parameters, other video devices, different configurations in /boot/config.json, but nothing fixed the issue.
I also used v4l2-compliant to check if /dev/video0 should works, the result is good:
Total for unicam device /dev/video0: 46, Succeeded: 46, Failed: 0, Warnings: 0
What help do you need?
I’m using a third party software that supports ffmpeg video streams as an input. So I need to get the camera running with ffmpeg. All my tests via v4l2 where unsuccessful so far.
Unfortunately, the video0 node outputs Bayer RAW format, which ffmpeg doesn’t support, and it doesn’t have ISP support either.
What libcamera does is get RAW image from video0, send it to ISP for processing, and output the result. If you don’t have special requirements, you can try V4l2loopback, check Create a virtual video node (Access by Python):
I now created a v4l2 loopback device and tried to convert the camera stream to a ffmpeg compatible one using v4l2tools (https://github.com/mpromonet/v4l2tools). Unfortunately without any luck. Using
v4l2compress /dev/video0 loopbackDevice
I get the same error message, as with ffmpeg:
VIDIOC_STREAMON: Invalid argument
Isn’t there any practical way to convert the camera stream to a more usable format? (Without the need to write your own code)
If you just want to simply let ffmpeg receive the data output by libcamera, you can use pipe, for example this is an example of using libcamera to encode h264 and use ffmpeg to pack as mp4:
Hi @engineer3003
We currently do not provide for the gstreamer commands on Raspberry Pi.
I would like to know the reason you chose gst commands on your Pi. Do you intend to steam the camera?
My ultimate goal is to access the camera with ffmpeg for use with homebrew to create an Apple Homekit camera. From the post above mine from Wong, it looked like the gst-launch-1.0 libcamerasrc command can be used to create a loopback video device that then can then be used with ffmpeg.
Hi,
Two weeks ago, I got my PC to receive the stream from the camera connected to my Pi 5. The use case is referred to ffmpeg + RTSP server. I have no idea if it would be a help to you.
Setting Up a Lightweight RTSP Server with RTSP Simple Server
1. Setting Up the RTSP Server on Your Laptop
Installing RTSP Simple Server
You can download the executable file from the RTSP Simple Server’s GitHub page and run it. Here are the steps to install and run it:
Download RTSP Simple Server:
Download the precompiled binary suitable for your operating system from here.
Extract and Run:
After downloading, extract the files and run the rtsp-simple-server executable file.
On Linux or macOS:
./rtsp-simple-server
On Windows:
Double-click rtsp-simple-server.exe to run it.
2. Pushing Video Stream from Raspberry Pi
Now, ensure the RTSP server is running, then run the following command on your Raspberry Pi to push the video stream to your laptop’s RTSP server:
Replace <Laptop_IP> with the IP address of your laptop.
3. Playing the RTSP Stream on Your Laptop Using VLC
Open VLC Media Player.
Click on the “Media” menu, then select “Open Network Stream…”.
In the “Network URL” field, enter:
rtsp://<Laptop_IP>:8554/live.sdp
Replace <Laptop_IP> with the IP address of your laptop.
Click the “Play” button.
Notes
Firewall Settings:
Ensure that your laptop’s firewall allows the port on which the RTSP server is listening (port 8554 in this example).
Network Configuration:
Ensure that the Raspberry Pi and the laptop are on the same network and can access each other.
Summary
By running the RTSP server on your laptop and pushing the video stream from the Raspberry Pi to this server, you should be able to successfully play the video stream in VLC. If you still encounter issues, check your network connections, firewall settings, and the log outputs from both the RTSP server and FFmpeg to diagnose and resolve the problem.