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
7.31k stars 530 forks source link

Snapshot won't work with Reolink camera with 1.5.0 #417

Open luisiam opened 1 year ago

luisiam commented 1 year ago

I am adding a snapshot stream using the reolink snapshot URL

streams:
  backyard:
    - http://192.168.10.24/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=go2rtc&user=xxx&password=xxx

I am using the frame.jpeg url to feed that snapshot to other services like scrypted. image

It was working fine in previous version till I updated to go2rtc 1.5.0. Now, when I click that frame.jpeg link, I am getting exit status 1. image

I had another amcrest camera and I am doing the same thing which still works with go2rtc 1.5.0

Mr-HaleYa commented 1 year ago

Tried with both my Reolink E1 Zooms, did what you are saying and the first one gave me the same error then the other did not. When I tried the first one again the error didn't show and I've restarted and retried many times and it has not come back... I also have a Reolink Doorbell and it also worked fine. So I was able to recreate it once then never again...

running frigate 0.12.0 with go2rtc 1.15.0 binary installed

go2 rtc config snip

streams:
    loft_cam_test:
      - http://192.168.50.***/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=go2rtc&user=***&password=***
    lvrm_cam_test:
      - http://192.168.50.***/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=go2rtc&user=admin&password=***
    doorbell_cam_test:
      - http://192.168.50.***/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=go2rtc&user=***&password=***

What camera(s) are you using?

Do you have http access enable in the camera config? I tried using the snapshot feature without it enabled a while ago and it threw a lot of errors. image

luisiam commented 1 year ago

I figured it out. I have to set it up as a standalone stream. I had it set up as one of the sources in the same stream along with the main RTSP stream and it worked before version 1.5.0

Mr-HaleYa commented 1 year ago

so you fixed it? this can be closed?

luisiam commented 1 year ago

The behavior is different comparing to previous version. My full config was like that:

streams:
  backyard:
    - http://192.168.10.24/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=xxx&password=xxx
    - rtsp://xxx:xxx@192.168.10.24:554/h264Preview_01_main
    - ffmpeg:backyard#audio=opus
    - http://192.168.10.24/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=go2rtc&user=xxx&password=xxx

The frame.jpeg link was working with this config in previous version. But for go2rtc 1.5.0, I have to separate the snapshot into another stream.

streams:
  backyard:
    - http://192.168.10.24/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=xxx&password=xxx
    - rtsp://xxx:xxx@192.168.10.24:554/h264Preview_01_main
    - ffmpeg:backyard#audio=opus
  backyard_snapshot
    - http://192.168.10.24/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=go2rtc&user=xxx&password=xxx

Not sure if this change is intended.

AlexxIT commented 1 year ago

This is expected behaviour for v1.5: https://github.com/AlexxIT/Blog/issues/11

All streams now support JPEG snapshots. For MJPEG streams frame is taken directly. For H264/H265 cameras automatic transcoding with FFmpeg is used.

So go2rtc will take first source and will try to transcode it to JPEG. But anyway it shouldn't fail.

luisiam commented 1 year ago

I did further debug and found out that the snaphot won't work if I am using Reolink HTTP FLV source. If I changed to RTSP source, it will work. Following is the summary.

  1. Reolink with HTTP FLV source, go2rtc CANNOT generate snapshot
  2. Reolink with RTSP source, go2rtc can generate snapshot
  3. Reolink with HTTP snapshot source (from API), go2rtc can generate snapshot

I used HTTP FLV source for my reolink cameras because it is more stable than RTSP.