PR #26240 opened by Onur Tirtir (onurctirtir) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26240 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26240.patch
ffmpeg can extract embedded HEIF thumbnails by ID, but ffprobe doesn't identify thumbnail streams. With this commit, it sets heif_thumbnail=1 on streams with a thmb reference. >From e5164925bed3747ae937a741bf8cee05c9b16ecc Mon Sep 17 00:00:00 2001 From: Onur Tirtir <[email protected]> Date: Sat, 21 Nov 2026 03:39:15 +0300 Subject: [PATCH] avformat/mov: mark HEIF thumbnail streams ffprobe lists HEIF image streams without saying which are thumbnails. Set heif_thumbnail to 1 on streams with a thmb reference. --- doc/demuxers.texi | 3 +++ libavformat/mov.c | 9 +++++++++ tests/fate/mov.mak | 2 +- tests/ref/fate/mov-heic-demux-still-image-multiple-thumb | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index e21b887849e..e9bd8abde78 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -952,6 +952,9 @@ Demuxer for Quicktime File Format & ISO/IEC Base Media File Format (ISO/IEC 1449 Registered extensions: mov, mp4, m4a, 3gp, 3g2, mj2, psp, m4b, ism, ismv, isma, f4v +For HEIF image streams, the demuxer sets the @code{heif_thumbnail} metadata +tag to @code{1} when it reads a @code{thmb} reference from the image. + @subsection Options This demuxer accepts the following options: diff --git a/libavformat/mov.c b/libavformat/mov.c index 3fe0304f4dd..66ae26b1551 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -12230,6 +12230,15 @@ static int mov_parse_heif_items(AVFormatContext *s) if (err < 0) return err; + for (int j = 0; j < item->nb_iref_to_list; j++) { + if (item->iref_to_list[j].type == MKTAG('t','h','m','b')) { + err = av_dict_set(&st->metadata, "heif_thumbnail", "1", 0); + if (err < 0) + return err; + break; + } + } + if (item->name) av_dict_set(&st->metadata, "title", item->name, 0); if (item->item_id == mov->primary_item_id) diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index b62aca69885..8961a507a66 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -306,7 +306,7 @@ fate-mov-heic-demux-clap-irot-imir: CMD = stream_demux mov $(TARGET_SAMPLES)/hei FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call FRAMECRC, MOV, HEVC MJPEG, HEVC_PARSER) \ += fate-mov-heic-demux-still-image-multiple-thumb fate-mov-heic-demux-still-image-multiple-thumb: CMD = stream_demux mov $(TARGET_SAMPLES)/heif/P1001091.HIF "" "-c:v copy -map 0" \ - "-show_entries stream=index,id:stream_disposition:stream_side_data_list:frame=stream_index:frame_side_data_list:frame_tags" + "-show_entries stream=index,id:stream_tags=heif_thumbnail:stream_disposition:stream_side_data_list:frame=stream_index:frame_side_data_list:frame_tags" # heic demuxing - still image with multiple items in a grid. FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call FRAMECRC, MOV, HEVC, HEVC_PARSER) \ diff --git a/tests/ref/fate/mov-heic-demux-still-image-multiple-thumb b/tests/ref/fate/mov-heic-demux-still-image-multiple-thumb index 628976644ee..3c8e4ab49f6 100644 --- a/tests/ref/fate/mov-heic-demux-still-image-multiple-thumb +++ b/tests/ref/fate/mov-heic-demux-still-image-multiple-thumb @@ -1970,6 +1970,7 @@ DISPOSITION:metadata=0 DISPOSITION:dependent=0 DISPOSITION:still_image=0 DISPOSITION:multilayer=0 +TAG:heif_thumbnail=1 [/STREAM] [STREAM] index=2 @@ -1993,4 +1994,5 @@ DISPOSITION:metadata=0 DISPOSITION:dependent=0 DISPOSITION:still_image=0 DISPOSITION:multilayer=0 +TAG:heif_thumbnail=1 [/STREAM] -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
