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

Stream Google Nest (WebRTC) from homeassistant to youtube #1101

Open
pertoft opened this issue May 9, 2024 · 3 comments
Open

Stream Google Nest (WebRTC) from homeassistant to youtube #1101

pertoft opened this issue May 9, 2024 · 3 comments
Labels
question Further information is requested

Comments

@pertoft
Copy link

pertoft commented May 9, 2024

Hi,

I am trying to stream a google nest cam to a youtube live stream (birdhouse project).
I can see the stream on the go2rtc gui fint (via homeassistant, as its impossible to configure otherwise).

However, Youtube dont detect the published stream. I have tested with an rtsp campera as input and that works.

I guess i need to re-encode the stream to h264 - correct?

hass:
  config: "/home/haas/"

streams:
  cam1:
    - hass://127.0.0.1:8123?entity_id=camera.kamera&token=<redacted>
publish:
    legehus: rtmp://x.rtmp.youtube.com/live2/<redacted>

What I have attempted to reencode:

hass:
  config: "/home/haas/"

streams:
  cam1:
    - hass://127.0.0.1:8123?entity_id=camera.kamera&token=<redacted>
    - "ffmpeg:back#video=h264#audio=aac"
publish:
    legehus: rtmp://x.rtmp.youtube.com/live2/<redacted>

Log:

root@zoneminder:/opt/go2rtc# ./go2rtc_linux_amd64
21:53:49.735 INF go2rtc version 1.9.0 linux/amd64
21:53:49.738 INF [rtsp] listen addr=:8554
21:53:49.745 INF [webrtc] listen addr=:8555
21:53:49.748 INF [api] listen addr=:1984
21:53:52.228 DBG [exec] run cmd="ffmpeg -hide_banner -v error -re -i back -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -c:a aac -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/bc63f1735c9aafddff245d734dacd92a" url="exec:ffmpeg -hide_banner -v error -re -i back -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -c:a aac -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
back: No such file or directory
21:53:53.257 DBG [streams] can't stop none producer
21:53:53.258 DBG [streams] start producer url=hass://127.0.0.1:8123?entity_id=camera.kamera&token=redacted

Help wanted :-)

@AlexxIT AlexxIT added the question Further information is requested label May 12, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented May 12, 2024

You don't get "stream name" idea.

  1. ffmpeg:back#video=h264#audio=aac - transcode stream "back", but you don't have it
  2. legehus: rtmp:// - publishing stream "legehus", but you don't have it
  3. Transcoding H264 to H264 in same stream - useless. Because clients will always use first (not transcoded) source.

@pertoft
Copy link
Author

pertoft commented May 13, 2024

Thanks for the update. I have tried to update the config to reflect the idea:

streams:
  legehus:
    - hass://192.168.1.4:8123?entity_id=camera.kamera&token=<redacted>
    - "ffmpeg:legehus#video=h264#audio=aac"

publish:
    legehus: rtmp://x.rtmp.youtube.com/live2/<redacted>

Have I stream concept understood it correct?

Logs from running:

root@zoneminder:/opt/go2rtc# ./go2rtc_linux_amd64

09:42:38.472 INF go2rtc version 1.9.1 linux/amd64

09:42:38.474 INF [rtsp] listen addr=:8554

09:42:38.475 INF [webrtc] listen addr=:8555

09:42:38.476 INF [api] listen addr=:1984

09:42:41.451 DBG [exec] run cmd="ffmpeg -hide_banner -v error -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://127.0.0.1:8554/legehus?video&audio -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -c:a aac -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/a9cd7676f930cce0c6e831fbd4b3b00c" url="exec:ffmpeg -hide_banner -v error -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://127.0.0.1:8554/legehus?video&audio -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -c:a aac -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/a9cd7676f930cce0c6e831fbd4b3b00c"

[rtsp @ 0x559ef31e4ec0] Unable to open RTSP for listening

rtsp://127.0.0.1:8554/legehus?video&audio: Address already in use
09:42:42.924 DBG [streams] start producer url=hass://192.168.1.4:8123?entity_id=camera.kamera&token=<redacted>

I have managed to run restreamer, consuming the rtsp stream from go2rtc and forward to youtube live, but its very unstable and I hope to get go2rtc working.

Btw, Very nice job!

@AlexxIT
Copy link
Owner

AlexxIT commented May 13, 2024

Unable to open RTSP for listening means you using very outdated ffmpeg version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants