AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
3.77k stars 307 forks source link

[FRIGATE] - Trying to convert my USBCAMERA into RTSP by using go2rtc #864

Open AURELB87 opened 5 months ago

AURELB87 commented 5 months ago

Hello,

I'm trying to configure my new USBWebcam on my Frigate server. What I would like is to use my USBCAMERA (/dev/video0) and create a stream (like "rstp://??") in order to reuse this stream.

I passed to have the stream from my USB CAMERA with this configuration in Frigate:

usbcam:
    detect:
      enabled: False
      width: 640
      height: 480
      fps: 30

    ffmpeg:
      inputs:
        - path: /dev/video0
          roles:
            - detect

=> This configuration into frigate is working fine and I have the stream.

But, to realize what I want to do, I tried to configure GOT2RTC to use it and convert (to reuse) the stream. Here is what I did:

go2rtc:
  streams:
    usbcam: ffmpeg:device?video=0

and

  usbcam:
    detect:
      # 640 x 480 30 fps
      enabled: False
      width: 640
      height: 480
      fps: 30

    ffmpeg:
      inputs:
        - path: /dev/video0
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/usbcam
          input_args: preset-rtsp-restream
          roles:
            - record

Inside the log, I have this message: ERR github.com/AlexxIT/go2rtc/cmd/streams/producer.go:53 > error="exec: exit status 1" url="ffmpeg:device?video=0

I tried several configuration (like "device?video = /dev/video0" or by adding "#video=h264").

Could you please help me to solve my problem ? Thank you very much.

AlexxIT commented 2 months ago

You can't use same device from two places simultaneously