I have been trying to generate a HLS stream encoded with h265 but with no success. I came across Generate hls stream using h265 codec but the solution given in it doesn't seems to be working.
Another approach that I tried was by running this command:
ffmpeg -hide_banner -y -i original.mp4 -c:v libx265 -tag:v hvc1 -force_key_frames expr:gte(t,n_forced*2) -c:a copy -profile:v main -crf 20 -sc_threshold 0 -g 60 -keyint_min 60 -hls_segment_type fmp4 -hls_time 6 -hls_playlist_type vod -vf scale=w=720:h=720:force_original_aspect_ratio=decrease,pad=ceil(iw/2)*2:ceil(ih/2)*2 processed/720p.m3u8
I also have added below in the master playlist.
CODECS=hvc1.1.6.L120.90,mp4a.40.2
When I put all the contents on S3 and use different players out there hls-js, bitmovin and akamai, they all seem to load the manifest file properly but aren't able to play the video.
Note: that above behaviour is only on Safari. It starts to throw manifestIncompatibleCodecsError on Chrome. I am assuming this is cause of chrome not being able to support H265 and that's fine for me as of now.
My ffmpeg version is N-102560-g4718d74c58
When I run mediastreamvalidator on the master playlist, it throws the error
mediastreamvalidator playlist.m3u8
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
Error injecting segment data
[720p.m3u8] All media files delivered and have end tag, stopping
Error injecting segment data
720p.m3u8
Processed 0 out of 20 segments
Average segment duration: 5.873333
Total segment bitrates (all discontinuities): average: 1722.41 kb/s, max: 2295.00 kb/s
Playlist max bitrate: 2500.000000 kb/s
Audio Group ID: AUDIO
Discontinuity: sequence: 0, parsed segment count: 0 of 20, duration: 117.467 sec, average: 1722.41 kb/s, max: 2295.00 kb/s
I am not really sure what went wrong here.
Extra Info
Found a few similar tickets with ffmpeg 6888, 7021, 7023 and 7024.
Out of these, while 6888 seems to have been fixed, rest others are still open (CMIIW). The fix for 6888 seems to be three years old. I am assuming by now it is merged into the master as well