Open glossyio opened 5 months ago
Are you sure about mjpeg
version? It's very strange to use it with mpegts
.
Are you sure about
mjpeg
version? It's very strange to use it withmpegts
.
Thanks for looking at this. I haven't used mjpeg only the h264, so I cannot confirm. I included it because that is what the RPi engineer said to try in their forum comment.
I haven't seen example with mjpeg+mpegts.
Using go2rtc in docker compose container I am not able to use rpicam stream. Is Source: Exec usable inside docker compose container?
Using go2rtc in docker compose container I am not able to use rpicam stream. Is Source: Exec usable inside docker compose container?
No, rpicam
is not available in a Docker container unless you install the library and all dependencies in the container and then pass through the camera as a device. I found it easier to install/configure go2rtc on the host machine and call the rtsp stream in the container.
Using go2rtc in docker compose container I am not able to use rpicam stream. Is Source: Exec usable inside docker compose container?
No,
rpicam
is not available in a Docker container unless you install the library and all dependencies in the container and then pass through the camera as a device. I found it easier to install/configure go2rtc on the host machine and call the rtsp stream in the container.
And how do you install and configure go2rtc and if you install what container do you call rtsp stream from?
And how do you install and configure go2rtc and if you install what container do you call rtsp stream from?
Here's how I use the Source Exec method (on the host RPi) and consuming it in the Docker containers.
Using Raspberry Pi OS bookworm (Full Install, since Lite does not have h.264 codecs), I install go2rtc :
sudo mkdir /var/lib/go2rtc
sudo curl -L https://github.com/AlexxIT/go2rtc/releases/download/v1.8.5/go2rtc_linux_arm64 -o /var/lib/go2rtc/go2rtc_linux_arm64
sudo chmod 755 /var/lib/go2rtc/go2rtc_linux_arm64
sudo chmod +x /var/lib/go2rtc/go2rtc_linux_arm64
I set it up to run as a systemctl service, so it always runs and restarts:
echo \
"# /etc/systemd/system/go2rtc_server.service
# to run: sudo systemctl stop/start/restart/enable/disable go2rtc_server
[Unit]
Description=go2rtc
After=network.target rc-local.service
[Service]
Restart=always
WorkingDirectory=/var/lib/go2rtc/
ExecStart=/var/lib/go2rtc/go2rtc_linux_arm64
[Install]
WantedBy=multi-user.target" | \
sudo tee /etc/systemd/system/go2rtc_server.service > /dev/null
sudo chmod 644 /etc/systemd/system/go2rtc_server.service
And write the go2rtc config as above to /var/lib/go2rtc/go2rtc.yaml
my settings look like:
"# /var/lib/go2rtc/go2rtc.yaml
streams:
picam_h264: exec:rpicam-vid --camera 0 --mode 2304:1296 --framerate 15 --exposure sport --hdr --timeout 0 --nopreview --codec h264 --libav-video-codec h264 --libav-format h264 --inline -o -
Start it up with
sudo systemctl start go2rtc_server
sudo systemctl enable go2rtc_server
Check that it worked by accessing go2rtc's web interface at http://<HOSTIPADDRESS>:1984/
You can then use it from any Docker container by calling the host either by hostname or IP address. E.g. I call it in Frigate by setting the configuration for cameras > ffmpeg > inputs > path
to rtsp://<HOSTNAME>:8554/picam_h264
thx @glossyio that works well
The documentation to get the RPi 5 working with the
exec
stream needs to be updated: https://github.com/AlexxIT/go2rtc#source-execCurrently reads
The RPi5 needs to have the libav codec specified, see explanation below.
Explanation, per RPi engineer at https://forums.raspberrypi.com/viewtopic.php?t=360020#p2180108
In addition, the RPi-native
libcamera-vid
is being renamedrpicam-vid
, per https://forums.raspberrypi.com/viewtopic.php?t=359569&sid=fee8e58134bceb78f9f5581094233a27