Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > VP9 and AV1

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd March 2025, 14:14   #1  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 371
AVIF to APNG

What can I use to convert animated AVIF files to APNGs without losing quality? Can ffmpeg do it? If so, how?

Last edited by jay123210599; 2nd March 2025 at 14:54.
jay123210599 is offline   Reply With Quote
Old 4th March 2025, 02:12   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,984
Quote:
Originally Posted by jay123210599 View Post
What can I use to convert animated AVIF files to APNGs without losing quality? Can ffmpeg do it? If so, how?
APNG is a lossless RGB format while AVIF is an (almost always) lossy format typically in YUV. So there would be some format conversion loss. And for most content, you'd actually wind up increasing the file size, as PNG's native lossless compression doesn't work well with the sort of slight variations a frequency transform codec tends to introduce. PNG can be quite efficient for computer-rendered graphics ala PowerPoint or a desktop, but is ill suited for continuous tone content like a photograph.

I'd guess AVIF and APNG have similar compatibility profiles, so what's your scenario for wanting to do this conversion? You may well be better off just sticking with AVIF, or generating the APNG from original uncompressed sources if available.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 4th March 2025, 14:17   #3  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 295
Quote:
Originally Posted by jay123210599 View Post
What can I use to convert animated AVIF files to APNGs without losing quality? Can ffmpeg do it? If so, how?
Try something to this effect:

Code:
ffmpeg -i "INPUT.avif" -sws_flags accurate_rnd+full_chroma_int "OUTPUT.apng"
GeoffreyA is offline   Reply With Quote
Old 4th March 2025, 17:47   #4  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 457
The answer is already, literally just 1 scientific poking away, or actually already answered by our replies in his old trolling threads
Z2697 is online now   Reply With Quote
Old 4th March 2025, 17:54   #5  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 457
Actually here's a catch LOL.
As I have mentioned many times, animated HEIF is just like a normal video file, but with the first key frame referenced as "thumbnail image".
Now, for FFmpeg, when reading such HEIF it sees them as two video streams, the default stream selection will probably pick the wrong one.

Last edited by Z2697; 5th March 2025 at 17:31.
Z2697 is online now   Reply With Quote
Old 5th March 2025, 06:21   #6  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 295
Quote:
Originally Posted by Z2697 View Post
Actually here's a catch LOL.
As I have mentioned many times, animated HEIF is just like a normal video file, but with the first key frame referenced as "thumbnail image".
Now, for FFmpeg, when reading HEIF it sees them as two video streams, the default stream selection will probably pick the wrong one.
Alas, there's always a glitch with FFmpeg!
GeoffreyA is offline   Reply With Quote
Old 5th March 2025, 17:32   #7  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 457
Quote:
Originally Posted by GeoffreyA View Post
Alas, there's always a glitch with FFmpeg!
I'm OK to call it a feature, not a bug
Z2697 is online now   Reply With Quote
Old 5th March 2025, 20:09   #8  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 295
All right, with due deference to the FF of the MPEG, we'll call it a feature
GeoffreyA is offline   Reply With Quote
Old 5th March 2025, 21:09   #9  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,984
Quote:
Originally Posted by GeoffreyA View Post
All right, with due deference to the FF of the MPEG, we'll call it a feature
Yeah, you can specify the stream you want to use in the command line.

FFmpeg can do anything, if you can figure out the syntax. But the syntax is not easy to figure out!
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 6th March 2025, 07:27   #10  |  Link
GeoffreyA
Registered User
 
Join Date: Jun 2024
Location: South Africa
Posts: 295
Quote:
Originally Posted by benwaggoner View Post
Yeah, you can specify the stream you want to use in the command line.

FFmpeg can do anything, if you can figure out the syntax. But the syntax is not easy to figure out!
When I discovered FFmpeg in 2018, I was astonished that it could do anything, quite a departure from the old way of using a range of tools to encode something. In the 2000s, I would use DVD Decrypter, DVD Audio Extractor, Azid, XMPEG, and VirtualDub to go from DVD to DivX-MP3 AVI. FFmpeg's syntax is like an obscure, miniature programming language at times, but when one finds something out, it's another weapon in one's toolkit.

Last edited by GeoffreyA; 6th March 2025 at 07:38.
GeoffreyA is offline   Reply With Quote
Reply

Tags
avif, converstion, png

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.