[FFmpeg-devel] [PATCH 2/2] libavformat: Enable jpeg streams in HEIF MOVContext

Lynne dev at lynne.ee
Thu Jul 17 14:54:09 EEST 2025


Thanks. Patchset LGTM.
This also helps HEIF files generated by the S1II, but sadly they still fail:

 > [mjpeg @ 0x55a49a0e29c0] No JPEG data found in image

And for the main stream:

 > [hevc @ 0x55a49a0fe880] Failed to parse header of NALU (type 34): 
"Invalid data found when processing input". Skipping NALU.
 > [hevc @ 0x55a49a0fe880] Invalid NAL unit size (1229531648 > 102386).
 > [hevc @ 0x55a49a0fe880] Error splitting the input into NAL units.
 > [vist#0:0/hevc @ 0x55a49a0e5000] [dec:hevc @ 0x55a49a103a80] Decoding 
error: Invalid data found when processing input

I wonder what they're doing with the thumbnail and NALUs. If you'd like 
to take a look at it, here's a sample:
https://files.lynne.ee/P1001083.HIF

On 17/07/2025 11:30, Eric Joyner wrote:
> Nikon HEIFs from a camera or NX studio include a small jpeg thumbnail in addition to
> the expected HEVC thumbnails; allowing jpegs allows all thumbnails to
> have an associated stream for Nikon HEIF files.
> 
> With this, Nikon HEIFs can finally be decoded without failing and the
> thumbnails can be extracted into their own files.
> 
> Signed-off-by: Eric Joyner <erj at erj.cc>
> ---
>   libavformat/mov.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 7010e13b50..19b31b032d 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -8840,6 +8840,7 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx)
>   
>       switch (item_type) {
>       case MKTAG('a','v','0','1'):
> +    case MKTAG('j','p','e','g'):
>       case MKTAG('h','v','c','1'):
>           ret = heif_add_stream(c, c->heif_item[idx]);
>           if (ret < 0)


More information about the ffmpeg-devel mailing list