Streaming H.265 content to a Chromecast with FFmpeg and VLC.
Intro
The Chromecast 1st, 2nd and 3rd gen does not support H.265 content. It does support H.264 content.
This means you can watch your H.265 content on your Chromecast without having to buy a Google TV by using some transcoding.
I will be offloading the work for transcoding to my GPU but this is viable via CPU encoding too.
I will include a version of commands to use your CPU also.
Requirements
Optional
An Nvidia GPU with CUDA drivers installed.
Required
A Chromecast.
Video content encoded using H.265.
The process
Browse to where you have your video content that you want to stream to your Chromecast.
Use one of the below commands to prepare the transcoding.
GPU transcode with CUDA
If GPU encoding fails you can always use the CPU command below this command.
ffmpeg -c:v h264_nvenc -c:a aac -ab 128k -ac 2 -b:v 3600k -minrate 3600k -maxrate 3600k -bufsize 8000k -pass 1 -movflags frag_keyframe+empty_moov+faststart+delay_moov -listen 1 -vf scale_cuda=format=yuv420p -f mp4 http://127.0.0.1:9999 -stats -hwaccel cuda -hwaccel_output_format cuda -i YOUR_VIDEO_NAME.FILEFORMAT
CPU
ffmpeg -c:v libx264 -c:a aac -ab 128k -ac 2 -b:v 3600k -minrate 3600k -maxrate 3600k -bufsize 8000k -pass 1 -movflags frag_keyframe+empty_moov+faststart+delay_moov -listen 1 -f mp4 http://127.0.0.1:9999 -i YOUR_VIDEO_NAME.FILEFORMAT
This will prepare a stream at http://127.0.0.1:9999.
Open VLC player. In the top left click “Playback” go down to “Renderer” and select your Chromecast.
In the top left click on “Media” and select “Open Network Stream”.
Paste http://127.0.0.1:9999 into the input box and press play.
This should result in the content being transcoded as it is streamed to your Chromecast.
Outro
It looks like the Google TV supports H.265 content so that may be a worthy upgrade.
For me transcoding content works fine.