Live Stream from an Amcrest Camera to a Chromecast enabled TV

Hello,

Does anyone know how to configure Home Assistant to be able to live stream from a Amcrest camera to a Chromecast enabled TV? My end goal is to be able to use Google Home to say “Hey Google, live stream the front door camera” and it would live stream to my TV.

The live stream URL would in this format: http:///cgi-bin/realmonitor.cgi?action=getStream&channel=&subtype=

Any help is appreciated, thanks.

1 Like

Chromecast require direct link to .mp3 or .mp4 file.
other format may be supported but in any case it must be direct link to file

you could:

1.download video to .mp4 file using script
2.place image file in location accessible by Chromecast
3.send video file to chromecast using script

Currently I am able to playback MP4 files fine. What I’m trying to do is stream live video from the camera to the Chromecast.

Maybe try playing the MPEG stream like you would do with an mp3/4 file

place in automation.yaml.
change tab spacing if placing in configuration.yaml

not my weblink but it was known good link playable on chromecast used for testing (havent used in a while)

- alias: 'Motion at Front Door'
  trigger:
    - platform: state
      entity_id: binary_sensor.frontdoorcam
      from: 'off'
      to: 'on
  action:
    service: media_player.play_media
    data:
      entity_id: media_player.audiocast_bedroom
      media_content_id: http://www.noiseaddicts.com/samples_1w72b820/3709.mp3

EDIT:
Sorry, misread…LIVE VIDEO NEEDED
from here. https://www.reddit.com/r/Chromecast/comments/50o9yo/rtsp_streaming/
He converts RTSP to playable format

I'm using ffmpeg to convert it to a HLS stream:
ffmpeg -rtsp_transport tcp -i rtsp://admin:[email protected]/live/ch1 \
  -acodec copy \
  -vcodec copy \
  -hls_wrap 40 \
  -flags -global_header \
  /var/www/html/cam/cam.m3u8
I happen to already have a web server running on my PC, so any other client on the LAN (e.g. the Chromecast) can now access http://192.168.0.2/cam/cam.m3u8
I use Web Video Cast to send that HLS stream to the Chromecast.
2 Likes

Can i use m3u8 link list?

Yes. .m3u8 link can be used.
You should also be able to use in notification

Thanks! So i just need to add the - alias: ‘Motion at Front Door’ to my configuration.yaml?
and then just add the line .m3u8 to media_content_id:?

Sounds correct s.

Make sure it points to file location inside /.homeassistant/www folder

EDIT: don’t quote me on the file location, but I believe that’s the about where it looks. OR any valid web accessible file

@mqbui1 @tmjpugh Were you guys able to accomplish this?

I also have Amcrest cameras with RTSP streams. I spent a lot of time on this today and could not get the HLS stream to load in Chromecast devices, it loads fine in VLC and other HLS capable players. Already tried:

  • Checked that the server hosting the HLS file (.m3u8) is returning the correct headers, including CORS headers, content type
  • Tried all the combinations of codecs offered in the camera config and different resolutions, framerates, bitrates
  • Tried transcoding the file in FFMPEG even tho the RTSP stream from the camera is already h264

Just can’t get this working on Chromecast…

The last problem turned out to be the audio encoding which was incompatible with Chromecast. Changing the audio to AAC in the Amcrest camera encoding options was the last thing I was missing.

1 Like

What does your code look like?

I made a docker image for this: Built a docker image to allow casting generic security camera streams into chromecast devices

2 Likes

Oh man you’re basically a superhero. Unfortunately I’m not sure how to apply this to my Raspberry Pi 3 running hassio. Could you provide instructions or point to a resource that would help me understand how to apply this to my setup?

To make it very easy to use someone would have to transform that into Hassio Add-on. In my case I have other servers in my house and that’s where I run it (Raspberry Pi 1 can take care of a few cameras)

There is also the question of if it’s a good idea to run this in the same box running Home Assistant, if your camera streams area already set to AAC and h264 for audio and video it will be light on CPU and should be ok to run on the same box, If not the transcoding will take a lot of CPU resources.

1 Like

I can’t get this going i’ve tried.

script:
  babycamera:        
    sequence:
      - service: media_player.play_media
        data:
          entity_id: media_player.lounge_display
          media_content_id: rtsp://xxxxx:[email protected]:80/cam/realmonitor?channel=1&subtype=00&authbasic=[AUTH]
          media_content_type: 'image/jpeg'

The url works ok in VLC, just wont work on the home hub, it just displays the cast logo not the video.

1 Like

ever managed to get a rtsp link to work with the media_player component?

Yes it’s working now

Can you show me your code? I can’t use rtsp :frowning:
If I use http , it works though

Unfortunately, I can’t show you currently I’m on holiday.