Google Assistent + Chromecast + HLS Video Stream

All points to Google issue… :face_with_symbols_over_mouth:

I´m not convinced to be honest… I still believe its a setting issue somewhere.
The issues I´m suffering atm seems to be around the ipcamera binding or the openhab system itself. Its very unstable. I restarted openhab a few minutes ago, and things do seem to run abit smoother. Maybe my Rpi3B+ is simply beeing pushed to hard :frowning:

All what my RPi3 does is make the link between the stream from ServerPC and Google.

I know… it was to say, that I think it is working fine for me, but my problems are around the Rpi.

I took a small look at Zoneminder, but unfortunatly it requires linux, which I´m no good at. I look for some easy way to test/use it the same way as you do, but using my windows desktop PC insted. Ffmpeg can run on windows, but I´m not sure how to trigger the streaming start.

I think its an openhab/permission issue somewhere… But I honestly dont understand why.
Using a simular situation like yours, I cant get it to work either. I have started a new thread (maybe a bad idea insted of keeping it in here) about link an item to an external url.

Hi Herbert…
Rich and Rossko mentioned that using a direct url in a item is not possible. Rich then suggested to try update the item though karaf (or Rest API).

I just updated the item though karaf, and now I can start the stream just fine from my Chromecast V3.

In case you need to know how… This is how its done using Karaf:

smarthome:update <item> <state>

After you send the item state, give it a check with:

smarthome:status <item>

There are some more info in this doc:

Thanks for the hint…I’ll give it a try and report back

Edit:

openhab> smarthome:update Kamera_Einfahrt_HLS http://192.168.178.222/hls/Videos/einfahrt.m3u8
Update has been sent successfully.
openhab> smarthome:status  Kamera_Einfahrt_HLS
http://192.168.178.222/hls/Videos/einfahrt.m3u8

unfortunately Chromecast still not showing the stream

ffmpeg used

ffmpeg -rtsp_transport tcp -i rtsp://192.168.178.206:554/user=admin_password=<password>_channel=1_stream=0.sdp?real_stream     
-preset veryfast -g 25 -sc_threshold 0       
-c:v libx264 -crf 21     -c:a aac -b:a 128k -ac 1    
-map v:0 -c:v:0 libx264 -b:v:1 6000k -maxrate:v:1 6600k -bufsize:v:1 8000k    
-map a:0 -map a:0 -c:a aac -b:a 128k -ac 1    
-f hls     -hls_list_size 15     
-hls_flags delete_segments    
-hls_time 2     einfahrt.m3u8

item file

String Kamera_Einfahrt_HLS      "Einfahrt"      { ga="Camera" [ protocols="hls" ], url="http://192.168.178.222/hls/Videos/einfahrt.m3u8" } // used for Google Assistant streaming to Chromecast V3
Switch Kamera_Stream "Stream" // used for rule ChromecastBinding

alternative used with rule to send via Chromecast binding directly

rule "Kamera Stream An"
when
	Item Kamera_Stream changed to ON    
then
	playStream("chromecast:chromecast:808d71071f9df31fd1f34be410fa49e0","http://192.168.178.222/hls/Videos/einfahrt.m3u8")
	sendBroadcastNotification("Stream Started")
end
rule "Kamera Stream Aus"
when
	Item Kamera_Stream changed to OFF   
then
	playStream("chromecast:chromecast:808d71071f9df31fd1f34be410fa49e0","null")
	sendBroadcastNotification("Stream Stopped")
end

ffmpeg log

 Opening 'einfahrt0.ts' for writing
Output #0, hls, to 'einfahrt.m3u8':
  Metadata:
    title           : RTSP Session
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080, q=-1--1, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s
    Metadata:
      encoder         : Lavc58.54.100 aac
    Stream #0:2: Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s
    Metadata:
      encoder         : Lavc58.54.100 aac
[hls @ 0x558ab76d5ec0] Opening 'einfahrt.m3u8.tmp' for writing/A dup=6 drop=4 speed=1.57x    
[hls @ 0x558ab76d5ec0] Opening 'einfahrt1.ts' for writing
[hls @ 0x558ab76d5ec0] Opening 'einfahrt.m3u8.tmp' for writing/A dup=6 drop=4 speed=1.25x    
[hls @ 0x558ab76d5ec0] Opening 'einfahrt2.ts' for writing
[hls @ 0x558ab76d5ec0] Opening 'einfahrt.m3u8.tmp' for writing/A dup=6 drop=4 speed=1.16x    
[hls @ 0x558ab76d5ec0] Opening 'einfahrt3.ts' for writing
[hls @ 0x558ab76d5ec0] Opening 'einfahrt.m3u8.tmp' for writing/A dup=6 drop=4 speed=1.12x   

Browser and VLC working well

Which resolution is your camera setup for?

1920x1080

Hmm thats very odd…
Are you sure you did set the correct value (url) for the item in Karaf or Rest API?

I just tested 1280x720 (720P) and 1920x1080 (1080P).
I´m using MJPEG stream from camera with a bitrate of 1280. Unfortunatly its only 2fps.
I have a short delay where the stream will be aprox 5 seconds behind. But I dont think it can be any better for HLS streaming.
It works on all my GA devices. My Chromecast V3 do have a problem starting sometimes. Then I just ask it to start again and it works. My Home Hub sometimes have a issue keeping up the stream. My Lenovo Smart Display just work all the time.
A minute ago I have all devices running the same stream.

double checked, restarted openhab to be sure

openhab> smarthome:status  Kamera_Einfahrt_HLS
http://192.168.178.222/hls/Videos/einfahrt.m3u8

Thats very weird…
Do you only have one chromecast to test with?

Unfortunately …yes.

Step by step will invest in more devices …but now I stick with one. Have to play around more with zigbee in meantime

Well… Then there is only one way I can think of…
Install the ipcamera binding. Setup the cam, and test if you can get it to work that way.
If it works, then its not the Chromecast.
If it doesnt work, then I would say the Chromecast is having some issues.

I’ll do that, ip camera binding is installed but due to high CPU usage it doesn’t get used on RPI.
But worth a try

Just do a fast setup from PaperUI… Should take just a few minutes :smiley:

unfortunately i got errors

2020-05-29 10:31:50.150 [INFO ] [pcamera.internal.StreamServerHandler] - IpCameras file server could not find the requested file. This may happen if ffmpeg is still creating the file.

cleaning cache and restarting openhab…

Thats a normal “error” (its not an error, its an INFO). Just ignore that for now.

Make sure the ipcamera.m3u8 file is created in the ffmpeg output directory you have defined in the thing setup.
Also have an eye on the switch for starting the streaming (Channel startStream - Create the switch item and keep an eye on the item in the log). This switch should turn ON automaticly, when you request the stream from your Chromecast, and ffmpeg should start creating/updating the .m3u8 file and its .TS files in the output directory.

i understand so far…but i have issues viewing the snapshot url and the stream on browser already…not even tried on chromecast

Hm… Did you set it up as a generic ONVIF ? If that fails, your should see an error in the logfile, and you´ll have to set it up as HTTP ONLY, cause its not fully ONVIF compatible. (or check username/pw/ONVIF port for the camera).