jpeg-quantsmooth icon indicating copy to clipboard operation
jpeg-quantsmooth copied to clipboard

Frames from video exported to lossless PNG

Open Johnreidsilver opened this issue 3 years ago • 4 comments

I was wondering if the program can improve frames from low resolution video. I exported the frames to PNG (lossless) but since they are not accepted by the program I converted to JPEG Q=100 (still not a lossless step). I ran the program with max quality, -q 6, but there's no difference between frames.

So I'm guessing the program needs an "original" JPEG file and won't work with frames exported from video even though they have JPEG like compression artifacts.

Johnreidsilver avatar Aug 10 '20 12:08 Johnreidsilver

No, jpeg-quantsmooth works with jpeg quantization factors that your video does not have. For PNG, use https://github.com/ilyakurdyukov/gravityblur.

zvezdochiot avatar Aug 10 '20 12:08 zvezdochiot

Only if it's an MJPEG video (each video frame can be extracted as a JPEG image), because this program is focused on the JPEG format. Same algorithm be done for some video codecs that also use DCT, but this will require a lot of work (e.g. researching a specific codec).

ilyakurdyukov avatar Aug 10 '20 13:08 ilyakurdyukov

I'll explain your results about an image saved in JPEG format at 100% quality - a certain percentage of quality is converted into a quantization table (which may be specific to the JPEG encoder), which is saved in the JPEG file (not the percentage itself). This table is also used by Quant Smooth to determine which parts of the image are artifacts and which are not. At 100% quality, there are no JPEG compression artifacts, because this is the original image passed to the encoder, your image had artifacts before JPEG.

And if someone just resaves low quality with higher quality - Quant Smooth will not be able to remove all artifacts, because the original quantization tables from the first compression in JPEG are lost. You can save the image as a JPEG with a quality that matches the quality of your video (but it's hard to guess what percentage is corresponds to), and then with Quant Smooth you will get some filtering, but this is a misuse of the program and will be inaccurate.

Similar programs listed in the comparison work the same way.

Hopefully this will help you understand how this works.

ilyakurdyukov avatar Aug 10 '20 13:08 ilyakurdyukov

Hi @ilyakurdyukov .

Gradually the thought matured: Add custom_quality option and use it to generate the quantization matrix, not use internal one.

PS: It would be an interesting move.

zvezdochiot avatar Aug 10 '20 16:08 zvezdochiot