Skip to content

Decode animated avif into frames #2634

Answered by maryla-uc
avidseeker asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,
Currently avifdec doesn't support outputting all frames at once, but you can use the --index flag to specify the frame number that you want. You can use avifdec -i "$f" to print the information about the animation including the number of frames.

Something like this should work:

num_frames=$(avifdec -i "$f" | grep -Eo '[0-9]+ frames' | cut -d' ' -f1)
for i in $(seq -f "%03g" 0 $((num_frames-1))); do
  avifdec --index $i "$f" out-$i.png
done

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@avidseeker
Comment options

@wantehchang
Comment options

@maryla-uc
Comment options

Answer selected by avidseeker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants