Opened 2 years ago

Last modified 22 hours ago

#7480 open defect

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 (10)

comment:1 Changed 2 years ago by tbucher

  • Keywords hls mpeg-dash hevc added

comment:2 Changed 2 years ago by cehoyos

  • Keywords mpeg-dash hevc removed

comment:3 Changed 2 years ago by j_karthic

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 Changed 2 years ago by tbucher

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 Changed 2 years ago by j_karthic

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 2 years ago by j_karthic (previous) (diff)

comment:6 Changed 2 years ago by tbucher

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 Changed 2 years ago by j_karthic

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

comment:8 Changed 2 years ago by tbucher

  • Cc added

comment:9 Changed 5 weeks ago by Balling

  • Status changed from new to open

"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 work with command in #8904. no-opengop=1, BTW, does not even exist in x265...

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.

Now the issue that is still not there is


and not


comment:10 Changed 22 hours ago by gordon

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

Note: See TracTickets for help on using tickets.