High Efficiency Image File Format (HEIF and HEIC) is a container format for bitstreams coded by the High Efficiency Video Coding (HEVC) standard. Note that there is a subtle difference between HEIF and HEIC. HEIF is a file format for storing individual HEVC bitstreams of still images while the HEIC format is tailored to store HEVC bitstreams of still images and also motion pictures.
• HEIF/HEIC contains bitstreams based on HEVC intra coding for still images and inter coding for motion pictures;
• HEIF/HEIC supports 10-bit toned mapped High Dynamic Range (HDR) HEVC-coded bitstreams;
• Unfortunately ffmpeg does not support HEIF/HEIC. If you wish to convert, for example, a bitmap image to HEIC format, I recommend the free Microsoft Windows program entitled: “CopyTrans HEIC for Windows”: https://www.copytrans.net/copytransheic/. Note that this is a standard Win32/64 application.
Obtaining Information on the HEIC Internal Structure
Note that you can attain inforomation with a software application known as “mediainfo” (GUI and command line versions are available). Download location: https://mediaarea.net/en/MediaInfo/Download/Windows.
Examples (single image in a HEIC file):
mediainfo baboon.heic
Complete name: baboon.heic
Format: heic
Codec ID: heic (mif1/heic)
File size: 96.6 KiB
Image ID: 1
Format: HEVC
Format/Info: High Efficiency Video Coding
Format profile: Main Still@L3@Main
Codec ID: hvc1
Codec ID/Info: High Efficiency Video Coding
Width: 512 pixels
Height: 512 pixels
Color space: YUV
Chroma subsampling: 4:2:0
Bit depth: 8 bits
Stream size: 96.3 KiB (100%)
Color range: Full
Codec configuration box: hvcC
The following image is a stylized presentation of HEIF structure (for multiple bitstreams).
Taken from the thesis work “HIGH EFFICIENCY IMAGE FILE FORMAT IMPLEMENTATION” by LASSE HEIKKILÄ, 2016, Tampere University.
A useful Pyrthon script, entitled “HeifParser“, parses two important boxes from the metadata – iloc (item locations and sizes) and iinf (item type, e.g. image). It is worth mentioning that the item is not necessarily a still image; for instance, the item may be an auxiliary data section (e.g., a grid). In other words, if the number of items is, for example, 51, then it does not directly mean that the file contains 51 different still images.
- iloc – contains a table (an entry for each item) which specifies each item address and size. The script dumps three parameters: itemIdx (for some files itemIdx counting is ot started from 1 or zero), itemAddr (from the beginning of the file) and itemSize.
- iinf – contains a table (an entry for each item) which specifies item types. If the item type is hvc1 then the item is HEVC Still Image, if the item type is Exif then the image is either tiff or jpeg.
HeifParser Usage:
HeifParser.py [options]
Options:
-i
: input heif-file
-p
: optional, if present then input file is expected to in Apple’s format, default false, there is a difference in Apple HEIC format
Examples:
1) from Nokia mobile device
python HeifParser.py -i autumn_1440x960.heic
major brand: mif1
minor version: 0
minor brands:
mif1
heic
hevc
pitm-box version 0
Primary Index 20002 (0x4e22)
{ iloc box }
iloc version 0
Item Offset Field Length 4
Item Size Field Length 4
Item Base Offset Field Len 4
Item Count 2
ItemIdx 20002
ItemRefIdx 0
ItemAddr 0x224
ExtCnt 1
Extension Offs 0x0
ItemSize 0x46a80 (289408)
ItemIdx 20003
ItemRefIdx 0
ItemAddr 0x46cac
ExtCnt 1
Extension Offs 0x0
ItemSize 0xe4a (3658)
{ iinf-box }
iinf version 2
itemCnt 2
0 infe-box, version 2
ItemIdx 20002
ItemProtectionIdx 0
ItemType hvc1 // HEVC Still Image
Item Name HEVC Image
1 infe-box, version 2
ItemIdx 20003
ItemProtectionIdx 0
ItemType hvc1
Item Name HEVC Image
2) heic-file taken from Apple mobile device
python HeifParser.py -i apple/1.heic -p
major brand: heic
minor version: 0
minor brands:
mif1
heic
pitm-box version 0
Primary Index 49 (0x31)
{ parsing iloc-box }
iloc version 1
Item Offset Field Length 4
Item Size Field Length 4
Item Base Offset Field Len 0
Item Index Field Length 0
Item Count 51 // 51 items, but not all images
ItemIdx 1
ConstructMethod 0
ItemRefIdx 1
ItemAddr 0x5e4c
ItemSize 0xb6b0 (46768)
ItemIdx 2
ConstructMethod 0
ItemRefIdx 1
ItemAddr 0x114fc
ItemSize 0xba55 (47701)
……………..
ItemIdx 47
ConstructMethod 0
ItemRefIdx 1
ItemAddr 0x1addf0
ItemSize 0x517d (20861)
ItemIdx 48
ConstructMethod 0
ItemRefIdx 1
ItemAddr 0x1b2f6d
ItemSize 0x5a65 (23141)
ItemIdx 49
ConstructMethod 1
ItemRefIdx 1
Item address and size not interpreted yet
ItemIdx 50
ConstructMethod 0
ItemRefIdx 1
ItemAddr 0xf7a
ItemSize 0x46b6 (18102)
ItemIdx 51
ConstructMethod 0
ItemRefIdx 1
ItemAddr 0x5630
ItemSize 0x81c (2076)
{ parsing iinf-box }
iinf version 0
itemCnt 51
0 infe-box, version 2
ItemIdx 1
ItemProtectionIdx 0
ItemType hvc1
Item Name
1 infe-box, version 2
ItemIdx 2
ItemProtectionIdx 0
ItemType hvc1
Item Name
2 infe-box, version 2
ItemIdx 3
ItemProtectionIdx 0
ItemType hvc1
……………….
47 infe-box, version 2
ItemIdx 48
ItemProtectionIdx 0
ItemType hvc1
Item Name
48 infe-box, version 2
ItemIdx 49
ItemProtectionIdx 0
ItemType grid
Item Name
49 infe-box, version 2
ItemIdx 50
ItemProtectionIdx 0
ItemType hvc1
Item Name
50 infe-box, version 2
ItemIdx 51
ItemProtectionIdx 0
ItemType Exif
Item Name
23+ years’ programming and theoretical experience in the computer science fields such as video compression, media streaming and artificial intelligence (co-author of several papers and patents).
the author is looking for new job, my resume
I am always searching online for ideas that can aid me. Thanks!
Nice read, I just passed this onto a colleague who was doing some research on that. And he actually bought me lunch because I found it for him smile Therefore let me rephrase that: Thanks for lunch! “For most of history, Anonymous was a woman.” by Virginia Woolf.
Wow! This can be one particular of the most helpful blogs We have ever arrive across on this subject. Actually Great. I’m also an expert in this topic so I can understand your effort.
Good info. Lucky me I reach on your website by accident, I bookmarked it.
Thanks for sharing excellent informations. Your web site is so cool. I’m impressed by the details that you have on this site. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found just the info I already searched all over the place and simply could not come across. What a perfect site.
Great – I should certainly pronounce, impressed with your site. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Reasonably unusual. Is likely to appreciate it for those who add forums or anything, web site theme . a tones way for your client to communicate. Excellent task..
Good info. Lucky me I reach on your website by accident, I bookmarked it.
I enjoy the efforts you have put in this, thanks for all the great content.