Google Assistent + Chromecast + HLS Video Stream

I’m following the Community Topics very often and try to catch something up, but now i am somehow in a dead end ant dont know where the problem is.

Setup

  • I am using Openhab on a Rpi3, so far all working good
  • i am using separately a desktop PC for surveillance with 7 Cameras running Zoneminder
  • i recently got a google Chromecast 3

Issue

So far

  • Have the Stream from Zoneminder
  • Added Item to Openhab with Google specs
  • Camera is listed in Google Home
  • alternativ i used ffmpeg to make a separate HLS stream to be usable with Google with same result
String Kamera_Einfahrt_HLS      "Einfahrt"      { ga="Camera" [ protocols="hls" ], url="http://<myip>/hls/Videos/einfahrt.m3u8" }

What am i doing wrong? What am i missing?

See the readme for the ipcamera binding it has a list of things to be aware of like no audio or 4K video streams.

I’m not using ipcamera binding because I have a separate pc running zoneminder. I have the streams working well in browsers and on sitemap from OpenHAB. I use ffmpeg on that pc for the CPU load from ffmpeg to not stress the RPi running OpenHAB. The issue I have is that my Chromecast starts streaming the provided m3u8 link but the image is as shown on first post and don’t know why.

LE:

I’ve tested the HLS stream from the IP Camera binding, with same results. No image in Chromecast. tested the stream in browser, VLC, sitemap…working

You missed my point. Does not matter how you produce the HLS, there are certain things you need to be aware of as the chromecast is far more fussy over the format than a web browser. The readme has things you need to check and they will also apply to streams created by zoneminder.

One example is there MUST be an audio track and AAC is the only format it can be in.

I misunderstood your point first, I will have a closer look on the special HLS format for Chromecast. Thanks for pointing me there. I will report back after I try them out.

Could you share your ffmpeg settings?

I’m still adapting the settings, but so far i’ve tested with this:

ffmpeg  -i "http://<ZoneminderIP>/zm/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=30&buffer=1000&user=<username>&pass=<password>" \
     	-c:v libx264 -crf 21 -preset veryfast -g 25 -sc_threshold 0   \  
	-b:v:0 6000k -maxrate:v:0 6600k -bufsize:v:0 8000k  \
   	-f hls -hls_time 2 -hls_list_size 5 -hls_wrap 10 \
	-hls_playlist_type event einfahrt.m3u8

Thanks… If it helps alittle… This one is working for me:

-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4

Its´the default used for the ipcamera binding.

I am not using the IP Camera binding because i dont want to raise the CPU usage with encoding on the RPi, i use FFMPEG running on my surveillance PC. I’ve come so far to stream but Chromecast is not showing the stream. Stream is viewable in browser, VLC, … but none in chromecast.

i’ve tested this settings on ffmpeg now with source direct from camera and not zoneminder:

ffmpeg -rtsp_transport tcp -i rtsp://<ip.from.camera>:554/user=admin_password=<password>_channel=1_stream=0.sdp?real_stream \
    -preset veryfast -g 25 -sc_threshold 0   \
    -acodec aac \
    -vcodec h264 \
    -hls_list_size 4 \
    -hls_wrap 10 \
    -hls_time 2 \
    -flags -global_header \
    einfahrt.m3u8

so far got best result with that, exception is the view on my chromecast

all i get is this, no mather what ffmpeg options i am using

even with the settings you suggested

ffmpeg -rtsp_transport tcp -i rtsp://<ip.from.camera>:554/user=admin_password=<password>_channel=1_stream=0.sdp?real_stream \
-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4 \
einfahrt.m3u8

I know you dont use ipcamera, but maybe your could use the ffmpeg setting :smiley:

I just tested my Chromcast device (V1 I think). It worked fine too. Havn´t tested my Chromecast V3 yet, as its not connected to anything.

i’m getting a headache, dont know more where to look. so far its somehow problem with my Chromecast accepting the stream.

Do your camera suport acc audio?
I´ll test my CC V3 later

Btw… How do you cast your stream?

I just tested my ChromeCast V3… It doesnt work either… I get the same result as you…
Yet another Google fuck up!

And to make things worse…
When I set up my camera to use MJEPG, and I cast my camera to my Home Hub, the picture is twisted 90 degree. When I cast the same camera with the same setting to my Chromecast V1 or my Lenovo Smart Display 10", then the picture is just fine…

I´m getting more and more tired of Google these days :face_with_symbols_over_mouth:

EDIT - Just got streaming to work on my CC V3… Resolution 704x576 seems to work. (Still aac audio).
I think both the Home hub and the CC are very dependable on the resolution.
1920 x 1080 seems to work fine as well…

Using h264 compression that is.

This is the item created in Openhab

String Kamera_Einfahrt_HLS      "Einfahrt"      { ga="Camera" [ protocols="hls" ], url="http://<IP.From.Surveillance>/hls/Videos/einfahrt.m3u8" } // where FFMPEG is creating the m3u8 stream

I’ve tried now something else:

  • opened the stream einfahrt.m3u8 in Chrome Browser
  • used Chrome Browser to stream to Chromecast
  • got video on Chromecast

so…chromecast recieves streamings from network but not over google assistent (Google Home)

What do you mean by this?

I use voice command on my Google Mini (or Smartphone Google Assistant) to stream the Camera to Chromecast

Bridge between OpenHAB and Google Home working with all other Items i synced. When i use the Command "Show on " i get the black image shown posted earlier every time.

Okay, thats odd. Cause that the only way I can use voice command. If I use voice command directly to my Home Hub (or Lenovo Smart Display) I get an error. But If I use voice command to my Home Mini, and tell it to show camera om my Home Hub, it works fine…

Did you try a direct PlayStream from openhab using the Chromecast binding? (I havn´t tried this yet, but I would assume it works).

Didn’t try that yet…but i will try all possible solution to get this working as it should and eliminate the actual bug.

As you wrote earlier…

i think all of this issue is thanked to Google

LE
This is my actual Stream Data from VLC
codec
with this ffmpeg stream:

ffmpeg -rtsp_transport tcp -i rtsp://<ip.from.camera>:554/user=admin_password=<password>_channel=1_stream=0.sdp?real_stream \
-preset veryfast 
-g 25 
-sc_threshold 0       
-acodec aac    
-vcodec h264     
-hls_list_size 4    
-hls_wrap 10     
-hls_time 2     
-flags 
-global_header    
 einfahrt.m3u8

An this is from FFMPEG running:

  Metadata:
    title           : RTSP Session
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))

I got that error on my V1 chromecast when I first tried it. I think this was due to some error in the ipcamera binding. I restarted the binding, and then streaming to the chromecast worked fine.

I think much of these problems are a mix of Google having issues, ffmpeg is having some smaller issues, and perhaps some “cache” settings in the binding in openhab… I´m not quite sure…
So maybe you´ll need to restart your binding/services.

Right now it seems my devices are running (1920 x 1080) when camera is set to h264. If I change the input stream to mjpeg, my Home Hub show the picture 90degree twisted. I have tried making som changes to the ffmpeg settings to change that, but it doesnt seem to do any difference.
However - Both my Lenovo and my Home Hub seems to having problems keeping up the stream in 1920 x 1080… That may be a cache/speed problem for the devices because I use an Rpi3B+… Just strange that my chromecats devices does not having this problem.

I really feel your pain - I have been struggling for days now.

I’m excluding the cache/binding issue because i’m streaming from a desktop PC running linux and not using Openhab or any binding to stream to chromecast…only the Item created in Openhab (running also an Rpi3B+) that makes the link between my Camera stream comming from the PC (running on i5 CPU with 8GB Ram) and Google Home.

I’ll guess its a Google problem but not 100% sure yet