Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi camera only works with mjpeg not h264 #1041

Closed
JustinS-B opened this issue Apr 12, 2024 · 5 comments
Closed

Raspberry Pi camera only works with mjpeg not h264 #1041

JustinS-B opened this issue Apr 12, 2024 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation duplicate This issue or pull request already exists
Milestone

Comments

@JustinS-B
Copy link

Raspberry Pi 5 with freshly installed & fully updated full version of the Raspberry Pi OS 64bit desktop and a Raspberry Pi Camera 3 using 64bit go2rtc downloaded binary. Following the examples in the go2rtc documentation here, I have edited go2rtc.yaml to include the following lines.

streams:
  picam_h264: exec:libcamera-vid -t 0 --codec h264 -o -
  picam_mjpeg: exec:libcamera-vid -t 0 --codec mjpeg -o -

go2rtc starts normally from CLI and if I use the WebUI on port 1984, I can click on the picam_mjpeg stream link and streams to the webpage, exactly as expected.

justin@Pi5:$  ./go2rtc_linux_arm64 
11:27:35.601 INF go2rtc version 1.8.5 linux/arm64
11:27:35.602 INF [api] listen addr=:1984
11:27:35.602 INF [rtsp] listen addr=:8554
11:27:35.602 INF [webrtc] listen addr=:8555

However, if I click on the picam_h264 stream link, the web page is blank grey only displaying the text mse: streams: EOF

The CLI gives the following error:

11:32:31.187 ERR github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166 > error="streams: EOF"

If I click on the stream.html link, I get a grey video page with the following text:

webrtc/offer: streams: codecs not matched: JPEG => VP8, RTX, VP9, H264, ULPFEC, RED, OPUS, G722, PCMU, PCMA, TELEPHONE-EVENT, S16B, S16L
error

FIXED
However, if I edit go2rtc.yaml to add the switch --libav-format h264 to the picam_h264 stream entry, as below, everything seems to work exactly as it should.

streams:
  picam_h264: exec:libcamera-vid -t 0 --libav-format h264 -o -
  picam_mjpeg: exec:libcamera-vid -t 0 --codec mjpeg -o -
@AlexxIT AlexxIT added the documentation Improvements or additions to documentation label Apr 13, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 13, 2024

Probably libcamera developers have changed default params

@AlexxIT AlexxIT self-assigned this Apr 13, 2024
@marcob79
Copy link

marcob79 commented May 4, 2024

Probably it is something related to pi5 in particoluar

@AlexxIT AlexxIT added this to the v1.9.2 milestone May 15, 2024
@AlexxIT AlexxIT added the duplicate This issue or pull request already exists label May 15, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented May 15, 2024

#881

@AlexxIT AlexxIT closed this as completed May 15, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented May 18, 2024

@marcob79
Copy link

@JustinS-B how about performance of picamera in h264 mode on pi5 ?
if the stream running smooth even with at least FHD resolution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants