2
Suppose I have a sequence of PNG image files which may or may not contain an alpha channel (assume those that do have an alpha channel actually utilize it). While PNG files themselves have their own lossless compression, I can usually get much smaller filesizes by using lossless video codecs, such as x264. For example:
ffmpeg -framerate 60 -i out%04d.png -c:v libx264rgb -qp 0 out.mp4
has given me significant file savings over storing the original PNG files separately (1.92GB video file vs 4.51GB separately). However, I do not believe that this supports alpha channels, so I can't always use this codec. Ideally, I could find one codec that works in both scenarios (alpha and no alpha).
Do you know of an alternative lossless codec I can use that would give similar space savings while still supporting alpha channels? If you do but it isn't perfectly lossless, I'm willing to look at near-lossless alternatives as well.
Sadly, I wasn't able to get anywhere near as good of a compression ratio using ffv1 as using libx264. I assume this was because ffv1 is intra-frame and not inter-frame. Also, qtrle ended up turning the 4.51GB of PNG files into a a 16GB video file. Is there some version of ffv1 that uses inter frame compression? – jippyjoe4 – 2019-12-05T00:58:08.410
@llogan, do you know of any that use interframe compression and support an alpha channel? They seem to be mutually exclusive in my search. – ereHsaWyhsipS – 2019-12-09T04:34:16.127
@ereHsaWyhsipS Perhaps VP9 lossless mode will address your needs. It will require a RGB to YUV conversion as it only supports yuva420p in regards to alpha which may or may not concern you.
– llogan – 2019-12-09T20:47:58.140@llogan, unfortunately, the conversion to YUVA420 is a bit of a deal breaker. It really seems difficult to find the right codec. – ereHsaWyhsipS – 2019-12-18T20:40:53.587
@ereHsaWyhsipS Unfortunately there may not yet be a perfect solution to fulfill your requirements. – llogan – 2019-12-18T20:42:01.563