Live Stream from an Amcrest Camera to a Chromecast enabled TV

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'
    - platform: state
      entity_id: binary_sensor.frontdoorcam
      from: 'off'
      to: 'on
    service: media_player.play_media
      entity_id: media_player.audiocast_bedroom

Sorry, misread…LIVE VIDEO NEEDED
from here.
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 \
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
I use Web Video Cast to send that HLS stream to the Chromecast.

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

1 Like

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.

      - service: media_player.play_media
          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.

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.

Ow ok, have a nice vacation, maybe you can post afterwards :wink:

Is it much like the code above?

already back from holiday? :slight_smile:

it was working, but currently im just using the below and saying to my hub, hey google show the babycam or hey google show the babycam on xxxx display.

  - host:
    name: "Babycam"
    username: xxxxx
    password: xxxxx
    stream_source: rtsp
    port: 80
      - motion_detected
      - online
    scan_interval: 2
      - ptz_preset



Oh ok, thats different :frowning: