AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.54k stars 181 forks source link

No video from SV3C camera in HA #768

Closed sergeolkhovik closed 2 weeks ago

sergeolkhovik commented 2 weeks ago

Hi! I've got 3 cameras from SV3C (https://sv3c.aliexpress.com/store/5720035) and before installing them I checked RTSP stream and I could play it via ffplay without any issue (the URL is like rtsp://192.168.1.x/0 or rtsp://user:pass@192.168.1.x/0). One camera shows well in HA via simple card:

type: custom:webrtc-camera
url: rtsp://cam6.domain/0

while 2 other cameras show nothing:

image

Again, I tested those cameras with ffplay (and VLC) and RTSP stream is OK. Moreover, all those 3 cameras are captured by kerberos.io agents (on another host, DVR). HA is running on RPi 3 in core mode (PVE + service). In addition I tried to setup go2rtc on DVR host via docker:

  go2rtc:
    image: alexxit/go2rtc:latest
    container_name: go2rtc
    restart: always
    privileged: true
    ports:
      - "1984:1984"
      - "8554:8554"  # RTSP port (optional, if you need RTSP access)
      - "8555:8555"  # WebRTC
#      - "8888:8888"
#    network_mode: host
    environment:
      - TZ=${AGENT_TIMEZONE}
    volumes:
      - "/usr/local/src/kerberos.io/go2rtc:/config"

with go2rtc/go2rtc.yaml as:

streams:
  cam7:
    - rtsp://cam7.domain/0
  cam8:
    - rtsp://user:pass@cam8.domain/0

and none of the links that I can see at http://dvr:1984 works, the same black screen. Can you please help me how to debug this and dig more info to figure out what's wrong? I don't see any logs in HA log file or syslog, and see nothing in container as well:

go2rtc           | 13:52:19.296 INF go2rtc platform=linux/amd64 revision=a4885c2 version=1.9.4
go2rtc           | 13:52:19.304 INF config path=/config/go2rtc.yaml
go2rtc           | 13:52:19.306 INF [api] listen addr=:1984
go2rtc           | 13:52:19.306 INF [rtsp] listen addr=:8554
go2rtc           | 13:52:19.307 INF [webrtc] listen addr=:8555/tcp
AlexxIT commented 2 weeks ago

Most likely your camera is using the H265 codec. And your browser (including the RTC technology) does not support it. https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#codecs-madness

You can find out the codec by looking at the stream information in the go2rtc WebUI.

sergeolkhovik commented 2 weeks ago

Oh! Thank you very much for the update! Looks like the camera is really h265, the probe link has this in the json output:

      "medias": [
        "video, recvonly, H265",
        "audio, recvonly, PCMU/8000"
      ],

Can you please help me if I couldn't reconfigure camera to h264 on a weekend, as I can see in the docs I can use go2rtc to transcode into mjpeg via ffmpeg, right? And in this case the config should be like this:

streams:
  camera1:
    - ffmpeg:rts://cam7.domain/0#video=mjpeg

I'm asking this because I lost in the docs (https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#module-mjpeg). Thanks in advance!

AlexxIT commented 2 weeks ago

You should refer this docs section for transcoding https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#source-ffmpeg

sergeolkhovik commented 2 weeks ago

Those cameras were really configured for h265. Thanks!