Opened 4 years ago

Closed 12 months ago

Last modified 12 months ago

#7480 closed defect (fixed)

HEVC codec info string

Reported by: tbucher Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


ffmpeg -f lavfi -i testsrc -t 4 -c:v libx265 -tag:v hvc1 -x265-params no-opengop=1:no-scenecut=1:keyint=100:strict-cbr=1 -b:v 3M -bufsize 1500k -vf scale=-2:1080,format=yuv420p -use_timeline 1 -use_template 1 -single_file 0 -adaptation_sets "id=0,streams=0" -seg_duration 4 -hls_playlist 1 -init_seg_name "init_$RepresentationID$.m4s" -media_seg_name "seg_$RepresentationID$_$Number%06d$.m4s" -y -f dash manifest.mpd

should insert proper codec info string for HEVC both into master.m3u8 and manifest.mpd.

However, even though the tag is forced as hvc1, the resulting codec info string is hev1 in both manifest types, which is ignoring the forced tag or generated hvc1 box and it is not complete as specified by ISO, it is missing profile, level, etc.

resulting truncated master.m3u8

resulting truncated manifest.mpd
<Representation id="0" mimeType="video/mp4" codecs="hev1" bandwidth="3000000" width="1440" height="1080" frameRate="25/1">

Especially m3u8 is now problematic since native decoder in Safari is refusing such m3u8 playlist.
Inserting CODECS tag into master.m3u8 playlist is a recently commited feature, removing this tag or replacing the hev1 value with one based on ISO makes the stream in Safari playable again.

Not including FFmpeg log as it is irrelevant.

Change History (13)

comment:1 by tbucher, 4 years ago

Keywords: hls mpeg-dash hevc added

comment:2 by Carl Eugen Hoyos, 4 years ago

Keywords: mpeg-dash hevc removed

comment:3 by Karthick Jeyapal, 4 years ago

I have just now sent a patch to include the forced tag hvc1 instead of hev1.

Will the above patch solve this playout issue? Or does it require the profile, level etc., If it requires profile, level could you please point me to relevant spec, so that I can try to implement it.

comment:4 by tbucher, 4 years ago

Thank you.

With regards to the rest, yes, Apple apparently requires the whole codec info based on my trial & error attempts as long as native Safari player is involved, playback via MSE in Safari is more lenient.
I've cobbled up the codec info for my succesful playback based on This page lists ISO/IEC 14496-15 as the standard the development should refer to.

comment:5 by Karthick Jeyapal, 4 years ago

I have sent a patch to disable CODECS tag for HEVC streams.
I have tested that it plays in native Safari and things are back the way it was for HEVC streams.
Hope this fixes your issue.

Last edited 4 years ago by Karthick Jeyapal (previous) (diff)

comment:6 by tbucher, 4 years ago

Appreciated. I haven't tested it yet, but if its purpose is to remove CODECS tag for HEVC from master m3u8 to make them playable again, that should be fine for the time being.

However, HLS Pantos RFC specification says that CODECS tag SHOULD be present while Apple guidelines say the it MUST be present, so using it also for HEVC should be a given in the near future.

I read your comments on that patch why it is not implemented now, should we keep the ticket open in order to track this?

comment:7 by Karthick Jeyapal, 4 years ago

Sure, Let us keep this ticket open to track this issue.

comment:8 by tbucher, 4 years ago

Cc: added

comment:9 by Balling, 19 months ago

Status: newopen

"I was not sure what is the right format of that string. I saw some examples, like hvc1.2.4.L123.B0. But I didn't know what that meant"

That part is implemented in a2b1dd0ce301450a47c972745a6b33c4c273aa5d.

snprintf(attr, sizeof(attr), "%s.%d.4.L%d.B01", av_fourcc2str(st->codecpar->codec_tag), profile, level);

and looks like it works with command in #8904. no-opengop=1, BTW, does not work here in x265...

P.S. It does exist. See

That other issue with "for 2K and 4K resolution Apple clients don't playout properly even when properly constructed CODEC tag is there(hvc1.2.4.L153)" I do not think we should care. Apple 4K TV and not 4K cannot even play 24.000 video correctly, playing it as 24/1.001 and losing frames there every 41 seconds, so who cares. See Though Macbooks play that correctly even on MacOS, so that part does not suck.
P.S. Latest beta changed that to always output 24.000, LOL. It is even worse, of course.
P.S.2 they fixed it. Wow.
Now the issue that is still not there is


and not


Last edited 13 months ago by Balling (previous) (diff)

comment:10 by gordon, 17 months ago

According to

The specification for HEVC codec id strings can be found in ISO IEC 14496-15 dated 2012 or newer in the Annex E.3

comment:11 by Balling, 13 months ago

Okay, lets finalise this. Apple 4K 2021 fixed raised black in DV and previous models inluding not 4K got 24.000 integer and non-integer 24/1.001 support. Nuts! Cool, of course.

So who is going to add CODECS="hvc1"? Hey?

comment:12 by Balling, 13 months ago

So who is going to add CODECS="hvc1"? Hey?

Okay, I sent a patch.

Last edited 13 months ago by Balling (previous) (diff)

comment:13 by Balling, 12 months ago

Resolution: fixed
Status: openclosed
Last edited 12 months ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.