Reputation: 884
How is it possible to determine if an AVIF file is an animation without using third-party programs?
I try this with, but its all dont work
"44" byte for animation
0, 0, 0, 44, 102, 116 for animated files
https://stackoverflow.com/a/77907580/12782236
'ftypavif' и 'anim'. "anim" by the number of occurrences also doesn't work, because I have examples with 2 occurrences although there are more than 80 frames.
Counting the "av01"
I tried to find it by the number of "trak", but it turns out that in animation there can be only 1 tag.
I studied the post about the structure by @dimitri-podborski https://stackoverflow.com/a/66555075/12782236
and about avif container by @daniel-a-simona-novomeská https://stackoverflow.com/a/66239407/12782236
Example 2 animated avif
https://drive.google.com/file/d/1dZIeBLItrlr81W2APZWMtxW4ni2V1j_H/view?usp=sharing https://drive.google.com/file/d/1dZIeBLItrlr81W2APZWMtxW4ni2V1j_H/view?usp=sharing
Upvotes: 1
Views: 50
Reputation: 15936
"I tried to find it by the number of
"trak"
Not every AVIF has a trak
entry.
Following info below is true for your shown example file ...
(1) Check ftyp section:
00 00 00 2C 66 74 79 70 61 76 69 73 ...,ftypavis
The ftyp
is avis
(where avis means "image sequence", or avif means "image file").
[0]
up to [7]
).[8]
, read the next 4 bytes as a String.However anyone could change the last letter from f
to being s
.
To confirm that it is avis
for sure, try step (2) below.
(2) Check stsz section:
00 00 01 70 73 74 73 7A 00 00 00 00 00 00 00 00 ...pstsz........
00 00 00 57 ...W
Your example file has one trak
box, and this same trak
also contains an stsz
box.
This section stsz
tells the byte lengths of each frame. The important part is that it also tells how many frames are in the file, so if the number is "more than 1" then you can assume that it is some animated AVIF.
73 74 73 7A
for "stsz" (is listing each sample/frame sizes).73 74 73 7A
tells the 32-bit size of total "stsz"
data. 73
).00 00 00 57
as one 32-bit integer.So are you expecting 87 frames? Why would a still image AVIF also have 87 pictures?
At this point, we can assume this one is an animated AVIF.
Upvotes: 1