[FFmpeg-trac] #10640(ffmpeg:new): Incorrect interpretation of PNG data in "monob" pixel format
FFmpeg
trac at avcodec.org
Thu Nov 2 00:10:07 EET 2023
#10640: Incorrect interpretation of PNG data in "monob" pixel format
----------------------------------------+----------------------------------
Reporter: Joey Sodergren | Type: defect
Status: new | Priority: normal
Component: ffmpeg | Version: 6.0
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------------+----------------------------------
**Summary of the bug:**
Since this summer, I've been doing a lot of experimentation with PNG
optimization. As part of my process, I started running files through
FFMPEG to re-encode them as a sort of "encoding normalization" step.
(Don't ask why this is necessary... I experimentally proved it helped the
rest of my system produce better / smaller results.) I have recently
discovered a bug in FFMPEG's ability to read some PNG files. While FFMPEG
''does'' appear to be aware that images in the {{{pal8}}} pixel format can
contain transparency data, it does not appear to be aware that images in
the {{{monob}}} pixel format can also contain transparency data, and is
improperly crushing it to opaque pixels.
**How to reproduce:**
1. The files {{{Palette_Mode.png}}} and {{{Monob_Mode.png}}} are encoded
with different pixel formats, but they both store their pixels as single
bits.
* These two files should be attached to this ticket.
* If you download them on Windows, inspect their Properties and open the
Details tab. You should see {{{Bit depth 1}}}.
1. The files {{{Palette_Mode.png}}} and {{{Monob_Mode.png}}} should appear
visually identical: fully opaque white glyphs on a fully transparent
background.
{{{
% ffprobe -hide_banner -v error -show_entries frame=pix_fmt
Palette_Mode.png
[FRAME]
pix_fmt=pal8
[/FRAME]
% ffprobe -hide_banner -v error -show_entries frame=pix_fmt Monob_Mode.png
[FRAME]
pix_fmt=monob
[/FRAME]
% ffmpeg -hide_banner -v error -i Palette_Mode.png -c png -pix_fmt rgba
-update 1 Pal_Expand.png
% ffmpeg -hide_banner -v error -i Monob_Mode.png -c png -pix_fmt rgba
-update 1 Mono_Expand.png
}}}
At this point, inspect the files {{{Pal_Expand.png}}} and
{{{Mono_Expand.png}}}. The file {{{Pal_Expand.png}}} should appear
visually identical to the input. The file {{{Mono_Expand.png}}}, however,
should not. Its transparent background will be improperly crushed to
opaque black.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10640>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list