Built a docker image to allow casting generic security camera streams into chromecast devices

when you use this with home assistant do you just do something like

  - service: media_player.play_media
      data:
        entity_id: media_player.tv
        media_content_id: http://192.168.1.100:8080/driveway.m3u8
        media_content_type: video/mp4 

I’m trying to get this up and running but keep getting a 403 forbidden error when I try and access host.ip:8080. Any idea what would cause this? Container appears to be running

Did anyone get to the bottom of this, I’m struggling with the same issue, maybe it’s the media_content type or something else - was it ever determined what the correct media type is, so at least I can rule that out?

1 Like

Me too, looking for a solution to this issue.

Found the problem!!

It seems to be a problem with the version of ffmpeg in the Alpine 3.7 image used. Changing the Docerfile to:

FROM alpine:latest

did the trick.

I’ve pushed a modified docker image at albertols/streamer to use

Do you want to make a PR to https://github.com/gihad/streamer? Maybe change from 3.7 to a fixed newer version that is known to work. LATEST could cause issue if they make changes in the future that are not backwards compatible.

If not no worries, I will make the PR later.

Be free to modify your own repo!

I’d have to do a lot of "clicks"to modify just a couple of bytes :wink:

No worries. I was just being courteous and giving you the opportunity to get the credit for the “problem” fix. The repo already has 140+ stars and several people using it.

After a couple of hours, the docker image stops re-encoding with the following errors:

...
[hls @ 0x7fd94f5091c0] pkt->duration = 0, maybe the hls segment duration will not precise
[hls @ 0x7fd94f5091c0] Opening '/tmp/stream/entrada5759.ts' for writing
[hls @ 0x7fd94f5091c0] Opening '/tmp/stream/entrada.m3u8.tmp' for writing
[hls @ 0x7fd94f5091c0] pkt->duration = 0, maybe the hls segment duration will not precise
    Last message repeated 2 times
[hls @ 0x7fd94f5091c0] Opening '/tmp/stream/entrada5760.ts' for writing
[hls @ 0x7fd94f5091c0] Opening '/tmp/stream/entrada.m3u8.tmp' for writing
frame=244069 fps= 15 q=-1.0 Lsize=N/A time=04:31:34.84 bitrate=N/A speed=   1x    
video:2151451kB audio:65246kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Any hint?

Also, in the logs there are also several (warning?) messages of the type:

frame=244055 fps= 15 q=-1.0 size=N/A time=04:31:34.20 bitrate=N/A speed=   1x    [hls @ 0x7fd94f5091c0] pkt->duration = 0, maybe the hls segment duration will not precise
    Last message repeated 7 times

It seems that the HLS stream is generated anyway, but I wonder if this normal. Some info on forums relate this messages to the absence of key-frames in the source RTSP stream. It’s a (chinese) EzViz camera. Can they be ignored?

Hi gmurad!! A fix and a work-around for your image…

  1. On create_ffmpeg_cmd.sh, line 23, add a space before ‘]’ (fixes a sh warning and a potential error on some streams)
# Check if it's empty to add silent dummy stream
if [ -z "$AUDIO_RESULT" ]; then
  LACKING_AUDIO="-f lavfi -i aevalsrc=0"
fi
  1. On startup.sh, replace line 16 with:
      echo "Starting ${OUT} stream"
      CMD=$(sh ./create_ffmpeg_cmd.sh ${IN} ${OUT})
      echo "FFMPEG="$CMD
      while true; do $($CMD); done &
      COUNTER=0

Provides feedback of the actual ffmpeg command syntax and creates a forever loop in case ffmpeg aborts for any reason.

Hope it helps!

Thanks @AlbertoLpx

The Alpine image update and also the missing space on create_ffmpeg_cmd.sh have already been fixed in PRs that people made to the repo in Github last year (that’s typically where the coding conversations happen). I admit that this was just an afternoon project for me and I never touched it again after that day but I will find some time to test and merge the PRs from the community.