This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 820a9f209d6736e4fca5813ffb94f0ba6c983e35 Author: Romain Beauxis <[email protected]> AuthorDate: Mon Nov 16 20:42:30 2026 -0600 Commit: Romain Beauxis <[email protected]> CommitDate: Sat Nov 21 13:32:34 2026 +0000 avformat/codecstring: read the HEVC codec string from an hvcC record Extradata from mp4 or Matroska is an HEVCDecoderConfigurationRecord, not Annex-B, so no SPS was found and HEVC copied from those containers got no string. The record holds the profile_tier_level fields right after configurationVersion. --- libavformat/codecstring.c | 19 +++++++++++++++++++ libavformat/tests/codecstring.c | 16 +++++++++++++++- tests/ref/fate/codecstring | 6 ++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/libavformat/codecstring.c b/libavformat/codecstring.c index a7a845dfb4..325942b118 100644 --- a/libavformat/codecstring.c +++ b/libavformat/codecstring.c @@ -156,6 +156,25 @@ int ff_make_codec_str(void *logctx, const AVCodecParameters *par, if (par->level != AV_LEVEL_UNKNOWN) level = par->level; + /* HEVCDecoderConfigurationRecord (ISO/IEC 14496-15), as in mp4 and + * Matroska: its profile_tier_level fields follow configurationVersion. + * Its NAL units have no start code to scan for. Any extradata not + * starting with a start code is taken as a record, which covers + * configurationVersion 0 from older muxers; this is looser than + * libavcodec, which wants the full 23-byte record. Only the 13 bytes + * up to general_level_idc are read. */ + if (data && par->extradata_size >= 13 && + (data[0] || data[1] || data[2] > 1)) { + /* Some muxers write a zeroed record: no profile, no level. */ + if (!(data[1] & 0x1f) || !data[12]) + return AVERROR(EINVAL); + parse_hevc_profile_tier_level(data + 1, &profile, + &profile_compatibility, &tier, + &level, constraints, + sizeof(constraints)); + data = NULL; + } + /* check the boundary of data which from current position is small than extradata_size */ while (data && (data - par->extradata + 19) < par->extradata_size) { /* get HEVC SPS NAL and seek to profile_tier_level */ diff --git a/libavformat/tests/codecstring.c b/libavformat/tests/codecstring.c index 7b30a865b7..8b193a5d2b 100644 --- a/libavformat/tests/codecstring.c +++ b/libavformat/tests/codecstring.c @@ -50,6 +50,16 @@ static const uint8_t hevc_hvcc[] = { 0x1e, 0xf0, 0x00, 0xfc, 0xfd, 0xf8, 0xf8, 0x00, 0x00, 0x0f, 0x00, }; +static const uint8_t hevc_hvcc_version0[] = { + 0x00, 0x01, 0x60, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1e, 0xf0, 0x00, 0xfc, 0xfd, 0xf8, 0xf8, 0x00, 0x00, 0x0f, 0x00, +}; + +static const uint8_t hevc_hvcc_zeroed[] = { + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x00, 0xfc, 0xfd, 0xf8, 0xf8, 0x00, 0x00, 0x0f, 0x00, +}; + typedef struct TestCase { const char *name; enum AVCodecID codec_id; @@ -76,7 +86,11 @@ static const TestCase cases[] = { AV_PROFILE_UNKNOWN, hevc_hvcc, sizeof(hevc_hvcc) }, { "hevc-hvcc-hev1", AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1'), AV_PROFILE_UNKNOWN, hevc_hvcc, sizeof(hevc_hvcc) }, - { "aac-lc", AV_CODEC_ID_AAC, 0, + { "hevc-hvcc-version0", AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1'), + AV_PROFILE_UNKNOWN, hevc_hvcc_version0, sizeof(hevc_hvcc_version0) }, + { "hevc-hvcc-zeroed", AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1'), + AV_PROFILE_HEVC_MAIN, hevc_hvcc_zeroed, sizeof(hevc_hvcc_zeroed) }, + { "aac-lc", AV_CODEC_ID_AAC, 0, AV_PROFILE_AAC_LOW, NULL, 0 }, }; diff --git a/tests/ref/fate/codecstring b/tests/ref/fate/codecstring index c3f03847b5..0e0e6dce59 100644 --- a/tests/ref/fate/codecstring +++ b/tests/ref/fate/codecstring @@ -4,6 +4,8 @@ h264-avcc: avc1.64000b hevc-annexb-hvc1: hvc1.1.6.L30.90 hevc-annexb-hev1: hev1.1.6.L30.90 hevc-annexb-untagged: error -hevc-hvcc-hvc1: error -hevc-hvcc-hev1: error +hevc-hvcc-hvc1: hvc1.1.6.L30.90 +hevc-hvcc-hev1: hev1.1.6.L30.90 +hevc-hvcc-version0: hvc1.1.6.L30.90 +hevc-hvcc-zeroed: error aac-lc: mp4a.40.2 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
