monkeymademe / picamera2-WebUI

This is a WebUI for the Picamera2 Library for the Raspberry Pi
MIT License
152 stars 21 forks source link

Option to change the streaming protoco #82

Open AleksanderKruecken opened 2 months ago

AleksanderKruecken commented 2 months ago

It seems that http://myserver:8080/video_feed_0 is MJPEG which is older video compression format which results in larger file sizes and lower quality compared to formats like H.264 which Picamera2 library also supports. According to Picamera2 library HLS stream and MPEG-DASH stream are also possible. Maybe you could add option for the user to choose the streamming protocol. For example Frigate likes cameras with RTSP stream and I have to do additional converting with go2rtc to integrate this MJPEG into it.

I managed to get the stream into Frigate and create clips when person is detected with following frigate configuration if someone will have similar problem:

mqtt:
  host: 172.17.1.116
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: *****
  password: *****

detectors:
  cpu1:  # Name the detector (can be anything)
    type: cpu
    num_threads: 3

go2rtc:
  streams:
    vzhodni_blok: http://172.17.1.19:8080/video_feed_0

cameras:
  vzhodni_blok:
    ffmpeg:
      inputs:
        - path: http://172.17.1.19:8080/video_feed_0
          input_args: preset-http-mjpeg-generic
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/vzhodni_blok
          input_args: preset-rtsp-generic
          roles:
            - record

version: 0.14
monkeymademe commented 2 weeks ago

Currently its possible now to change between the 2 encoders MJPEG and JPEG its not exactly what you asked for but for now at least there are some issues with the whole segmentation of video when using H.264 which I have yet to figure out. This needs more research on my part

Switching encoders can be found in the camera info section in one of the tabs. I'll maybe have to push this back to the next version or the next one after that (See: https://github.com/monkeymademe/picamera2-WebUI/discussions/103)