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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Display Modes
Old 6th January 2025, 07:31   #1  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 518
From PNGs to APNGs

I have 227 PNGs. I want to make APNGs out of them where each APNG has 50 frames in them. I also want to make all of the APNGs in one setting. How do I do that using ffmpeg?

Last edited by jay123210599; 16th January 2025 at 16:40.
jay123210599 is offline   Reply With Quote
Old 6th January 2025, 09:02   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
"From APNGs from PNGs",

Typo ?, Maybe "To APNGs from PNGs", or "From PNGs to APNGs".

Select EDIT, Advanced EDIT, on first post to edit thread title.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 6th January 2025, 09:56   #3  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 577
APNG implementaion in ffmpeg is subpar. You use https://apngasm.sourceforge.net/
Balling is offline   Reply With Quote
Old 6th January 2025, 10:03   #4  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by Balling View Post
APNG implementaion in ffmpeg is subpar. You use https://apngasm.sourceforge.net/
Seeing this now, Balling's solution would be the way to go and looks far simpler.
GeoffreyA is offline   Reply With Quote
Old 6th January 2025, 15:24   #5  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 518
Quote:
Originally Posted by Balling View Post
APNG implementaion in ffmpeg is subpar. You use https://apngasm.sourceforge.net/
I don't want any delays between my frames.
jay123210599 is offline   Reply With Quote
Old 6th January 2025, 15:33   #6  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 8,658
APNG without a delay makes no sense the delay is just a different word for FPS calculated differently.
huhn is offline   Reply With Quote
Old 6th January 2025, 16:21   #7  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by jay123210599 View Post
I don't want any delays between my frames.
As huhn points out, you can use a delay (0,041708375 should == 23.976 fps). Alternatively, my method works but requires editing the start and end variables.
GeoffreyA is offline   Reply With Quote
Old 6th January 2025, 20:07   #8  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 518
Well, the default frame delay is 1/10 sec. How do I adjust it so my output APNG has 23.976 fps?

Also, which compressions for the tools are lossless, zlib, 7zip, or Zopfli? How does the number of iterations affect the compression/speed/quality? If I choose to optimize the palette and/or original color type of the PNGs, will it affect the quality of the APNG?
jay123210599 is offline   Reply With Quote
Old 6th January 2025, 21:03   #9  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by jay123210599 View Post
Well, the default frame delay is 1/10 sec. How do I adjust it so my output APNG has 23.976 fps?

Also, which compressions for the tools are lossless, zlib, 7zip, or Zopfli? How does the number of iterations affect the compression/speed/quality? If I choose to optimize the palette and/or original color type of the PNGs, will it affect the quality of the APNG?
I'm not at the computer now to test it, but put in that value I posted, 0,041708375, and I reckon it should give 23.976 fps. As for the compression, try a few PNGs to convert to APNG, seeing which gives the better size; 7zip or Zopfli might have the edge. More iterations should yield better compression, but beyond some level, it will be diminishing returns.

Last edited by GeoffreyA; 6th January 2025 at 21:12.
GeoffreyA is offline   Reply With Quote
Old 6th January 2025, 10:00   #10  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Here's a working method for the time being. I tried to do it all automatically, but nested FOR loops are problematic in Windows batch files. So, you will have to change the "start" and "end" variables each time. The first time would be "start=1" and "end=50" and the second time, "start=51" and "end=100" and so on. Your filenames will have to be in the format of "1.png" and so forth, starting from 1. Please run this on a copy of your original folder in case something gets accidentally overwritten. I'll see if I can improve to do everything automatically.

Code:
setlocal EnableDelayedExpansion

set start=1
set end=50

mkdir "OUT"

(for /l %%i in (!start!, 1, !end!) do @echo file %%i.png) > "Jay2025.txt"

ffmpeg -f concat -r 23.976 -i "Jay2025.txt" "OUT\FINAL_%RANDOM%.apng"

pause
GeoffreyA is offline   Reply With Quote
Old 6th January 2025, 20:12   #11  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 1,004
they are lossless
Z2697 is offline   Reply With Quote
Old 6th January 2025, 21:30   #12  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 1,004
Shouldn't it be 1001/24000 = 0.0417833333333333333...?
Z2697 is offline   Reply With Quote
Old 6th January 2025, 21:39   #13  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by Z2697 View Post
Shouldn't it be 1001/24000 = 0.0417833333333333333...?
You are correct. I took the lazy option of dividing by 23.976.
GeoffreyA is offline   Reply With Quote
Old 7th January 2025, 17:14   #14  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 1,004
Why not test yourself?
You have no computer?
Z2697 is offline   Reply With Quote
Old 7th January 2025, 18:37   #15  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,669
My comments for "pallete optimization" for PNG were "in general" . It's a commonly used lossy technique for web graphics

If you're referring to apngasm specifically , the optimizations used there should be lossless according to the instructions.


Quote:
Some optimizations used in APNG Assembler might re-sort the
palette, or change the color type from RGBA and RGB modes
to RGB and indexed modes. Those optimizations are only performed
when they are lossless
, but if you want to avoid changing the
palette or colortype, use those switches to turn them off:

/kp : keep palette
/kc : keep color type
As usual, just read the instructions and/or test it yourself

Last edited by poisondeathray; 7th January 2025 at 18:41.
poisondeathray is offline   Reply With Quote
Old 7th January 2025, 20:06   #16  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by poisondeathray View Post
My comments for "pallete optimization" for PNG were "in general" . It's a commonly used lossy technique for web graphics

If you're referring to apngasm specifically , the optimizations used there should be lossless according to the instructions.
Noted. I didn't read the Readme.
GeoffreyA is offline   Reply With Quote
Old 8th January 2025, 16:52   #17  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 518
Here are my test files: https://www.mediafire.com/file/2ooty..._APNGs.7z/file

1-1 and 2-1 uses both color and palette optimization.

1-2 and 2-2 does use color nor palette optimization.

1-3 and 2-3 only uses palette optimization.

1-4 and 2-4 only uses color optimization.

All of them use zlib for compression.
jay123210599 is offline   Reply With Quote
Old 8th January 2025, 17:29   #18  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by jay123210599 View Post
Here are my test files: https://www.mediafire.com/file/2ooty..._APNGs.7z/file

1-1 and 2-1 uses both color and palette optimization.

1-2 and 2-2 does use color nor palette optimization.

1-3 and 2-3 only uses palette optimization.

1-4 and 2-4 only uses color optimization.

All of them use zlib for compression.
Good job on the testing, and well organised. Looks like it's of no use turning on those settings because the files are exactly the same size; even the hashes are identical.

I must say, Jay, I couldn't help but smile seeing the second set of APNGs. Thanks for bringing a bit of humour to the evening. What anime is that?
GeoffreyA is offline   Reply With Quote
Old 8th January 2025, 17:57   #19  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 518
Quote:
Originally Posted by GeoffreyA View Post
Good job on the testing, and well organised. Looks like it's of no use turning on those settings because the files are exactly the same size; even the hashes are identical.
You mean the colors? How did you prove they were the same?
jay123210599 is offline   Reply With Quote
Old 8th January 2025, 18:55   #20  |  Link
GeoffreyA
.
 
Join Date: Jun 2024
Location: South Africa
Posts: 708
Quote:
Originally Posted by jay123210599 View Post
You mean the colors? How did you prove they were the same?
I didn't test the colours. I just looked at the file sizes and hashes in 7-Zip. Whether they are the same as the PNGs, I do not know, but they, the APNGs, are identical to each other.
GeoffreyA is offline   Reply With Quote
Reply

Tags
ffmpeg, png

Thread Tools
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 01:18.


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