Get a HLS stream for a HVEC/h265 video

3.1k Views Asked by At

What I want to do?

Generate HVEC (h265) HLS of a mp4 file.

What I already have tried?

I came across this post https://superuser.com/a/1416549/1084556. It first asks to convert h264 video to h265 format and then do the HLS packaging`.

So I ran

ffmpeg -hide_banner -y -i "original.mp4" -c:v libx265 -c:a copy -y -movflags +faststart -tag:v hvc1 "h265.mp4"

Above command is good enough to generate a h265 encoded video which is working on QuickTime Player on macOS.

Next I

ffmpeg -y -i h265.mp4 -c copy \
    -hls_segment_type fmp4 -hls_time 6 -hls_list_size 10 \
    -hls_flags delete_segments+append_list+split_by_time \
    -hls_playlist_type vod hls.m3u8

Above command generated a few m4s along with hls.m3u8 and init.mp4 files, which seems to be the expected behaviour but when I host the files and try to play it in any online media player, it doesn't work, and throws error

A media error occurred: bufferIncompatibleCodecsError

Player used (https://hls-js.netlify.app/demo/, https://bitmovin.com/demos/stream-test)

1

There are 1 best solutions below

3
On

Based on the spec document both hls.js plugin and also the bitmovin player supports HEVC HLS format. You didn't mention about the browsers that you've tested. Based on my understanding, you can only playback HEVC/fmp4 HLS stream on safari browser. Worth testing that as well.