mkchromecast
mkchromecast copied to clipboard
Faster casting through -f mpegts/hls
How can I stream HLS
to the Chromecast?
If I am streaming with -f mpegts
or -f hls
I can stream with latencies of less than one second (on the same system). As soon as I'm using -f mp4
it goes quickly up to 5 seconds.
ffmpeg -thread_queue_size 512 \
-f x11grab -s 3200x1800 -framerate $framerate -i :0.0 \
-vaapi_device /dev/dri/renderD128 -vf format=nv12,hwupload,scale_vaapi=w=1920:h=1080 \
-c:v h264_vaapi \
-f hls \
- | nc -l -p 9000
Test with:
nc localhost 9000 | mplayer -benchmark -
For now I could only find ways to screen cast to the Chromecast using -f mp4
. I already found out that there's somewhere a mimetype hardcoded to /videos/mp4
and changed it - for now - to:
if mtype is None:
mtype = "application/x-mpegurl"
However, I still am not able to have anything appear on the screen. I know Chromecast is difficult on what kind of HLS stream it accepts, but it should be possible!
Are there some kind of hls
flags that will magically do this? I know it's kind of out of scope for your projects, but perhaps you'd like to tweak around. :-) Especially for screen casting it will be nice!