How do I convert a video into an image sequence of lossless webp files?
+ Reply to Thread
Results 1 to 20 of 20
-
-
webp lossless only supports "RGBA" in 8bit , the webp YUV compression is lossy.
webp lossless typically results in 10-30% better than PNG typical compression, but it varies on content. You can use brute force PNG optimzation such as optipng, pngcrush - but it might take minutes per frame for <1% better compression , and webp will still beat it . The main "negative" of webp is compatibility with some programs (should be ok in open source programs, modern browsers) . PNG is far more compatible
The "lossless" refers to 8bit RGB input - ie. there are no additional compression losses - but there will technically be some loss from the colorspace conversion if you start with YUV - because you can never get back the original YUV data with 8bit RGB. (Similar with PNG for 8bit and 16bit RGB - they will be lossy for YUV input)
You can use ffmpeg libwebp with -lossless 1
Code:ffmpeg -i input.ext -c:v libwebp -lossless 1 -start_number 0 output%06d.webp
e.g. for a typical "HD" source, ffmpeg might automatically get it correct or incorrect. If video has correct flags, it might get or correct (or not, sometimes ffmpeg builds have bugs, the recent one does for zscale this last week, so verify the input and output) . If you wanted to specify 709 matrix input manually you might use
Code:-vf zscale=min=709,format=bgra
-
-
PNG is 8 or 16bit RGB only too, so technically not lossless for YUV
TIFF supports YUV, and multiple compression schemes, but not all programs handle the YUV variant correctly
Why are you using an image sequence ? What is the background information or scenario ? How is it being used ? -
-
Upload images to a website, for a browser or mobile device(phone) for display ? Best bet is 8bit RGB, such as PNG (without gAMA or cHRM tags) , or webp
AVIF and HEIF support YUV , but they have even lower compatibility
Don't worry about the technical quality loss for 8bit RGB in your display scenario - When you "see" something on a monitor or TV it has been converted to RGB anyways - it's an RGB converted representation of that YUV data. If you playback a video in a video player, you're not watching YUV directly, but a RGB converted representation. The YUV to RGB loss might be important if it was part of pipeline where you were doing other manipulations. -
Not sure, I haven't used JPEGXL much or tested it in browsers for support
For any ffmpeg codec, you can print the help file to a text file by using
Code:ffmpeg -h encoder=blah 1>help.txt
Code:ffmpeg -h encoder=libjxl 1>libjxl.txt
Encoder libjxl [libjxl JPEG XL]:
General capabilities: threads
Threading capabilities: other
Supported pixel formats: rgb24 rgba rgb48le rgba64le gray ya8 gray16le ya16le grayf32le
libjxl AVOptions:
-effort <int> E..V....... Encoding effort (from 1 to 9) (default 7)
-distance <float> E..V....... Maximum Butteraugli distance (quality setting, lower = better, zero = lossless, default 1.0) (from -1 to 15) (default -1)
-modular <int> E..V....... Force modular mode (from 0 to 1) (default 0)
If it was for a website, I would stick to PNG or webp
Believe it or not, but many people in the world still use Windows XP (!) and legacy browsers . Some do not support webp properly. It's no good if people can't see your images. I'd use the highest compatibility format - PNG
But PNG can be tricky, because of the cHRM and gAMA tags. If you use something like ffmpeg, and the input YUV video has colorimetry tags, the output PNG will be tagged cHRM and gAMA tags. The problem is different programs, browsers (or even versions of the same browser) can display colors differntly if they are color managed.
But a non tagged "plain" sRGB PNG will almost always display the same in all programs. You can check PNGs with tweakpng
You can check your workflow with known colors, such as colorbars or patterns -
-
PNG is always lossless compression for 8bit or 16bit RGB - there is no lossy mode. But there can be display and handling problems (eg. the gAMA , cHRM tags above)
Compression is generally a processing time vs. compression ratio trade off , with diminishing returns. At the highest compression ratios it might take a long time for a tiny reduction in filesize, it might not be worth it for most people
For ffmpeg you can look at the help for the PNG options. The default is no prediction which is fairly fast in terms of PNG compression (PNG compression is slow overall, in general). Mixed prediction might be 3-4x slower but produce something 5-15% smaller in filesize.
Beyond that, there is brute force methods that can reduce an existing png with high compression even farther, but they are very slow at the highest compression - such as optipng, pngcrush . It might take a few minutes per frame to shave off another 0 - 1% . Diminishing returns. Webp lossless will still beat it (but people using old OSes and browsers might not support webp)
Can I set the compression rate for gif/apng files too (since they require encoding anyway) and not get any visual quality loss?
GIF is always very lossy for most sources , because it only support 256 colors. 8bit RGB such as PNG supports ~16.3 million colors .
There are GIF optimizers that produce large filesizes and better quality (compared to typical GIFS) and higher quality GIFs such as gifski .
PNG optimizers were mentioned above; and for ffmpeg apng the prediction settings are in the help file (same as png) -
By the way, I keep getting this for JXL. How do I fix that?
[Attachment 76215 - Click to enlarge] -
Those are probably correct assumptions for a typical HD source
Otherwise you probably need to set the primaries and transfer as mentioned earlier for YUV to RGB conversions
It looks like you need browser addons for JPEGXL support (does not come by default) . Many people will not have this and will not be able to see your images - I would avoid JPEGXL too for that reason -
-
-
-
Downscale to some lower resolution, or crop to a smaller area of interest if you're trying to show something specific
Do you need "lossless" ? For web delivery often high quality lossy is enough . If you need a full quality version, post it on some file hosting site like google drive for download separately
People will complain if it takes a few minutes to load your images and cause lag -
Similar Threads
-
can vlc player play folder of image sequence?
By Anonymous543 in forum Newbie / General discussionsReplies: 3Last Post: 18th May 2022, 13:25 -
Image sequence back into a video?
By jedi55 in forum RestorationReplies: 5Last Post: 6th May 2021, 20:42 -
Hybrid: Problem with creating video from image sequence
By Compositor in forum Newbie / General discussionsReplies: 7Last Post: 3rd Apr 2021, 08:09 -
Export PNG image sequence in Vegas 13?
By vegas13 in forum Newbie / General discussionsReplies: 7Last Post: 16th Dec 2020, 21:38 -
how do i load an image sequence into avisynth+ and can i use QTGMC on it ?
By oduodui in forum EditingReplies: 3Last Post: 28th Oct 2019, 16:45