Ticket #769 (closed defect: fixed)
png gray8 alpha decodes incorrectly
| Reported by: | ami_stuff | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avcodec |
| Version: | git-master | Keywords: | gray8a alpha png |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
I get different output with ffmpeg and ffplay
C:\>ffmpeg -i basi4a08.png
ffmpeg version N-35709-g7d531e8, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 12 2011 13:50:00 with gcc 4.6.2
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 43. 0 / 53. 43. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, image2, from 'basi4a08.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, gray8a, 32x32, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified
Attachments
Change History
comment:1 Changed 18 months ago by cehoyos
Please provide the ffmpeg command line that produces the output different from ffplay for you.
comment:3 Changed 18 months ago by ami_stuff
C:\>ffmpeg -i basi4a08.png ffmpeg.bmp
ffmpeg version N-35709-g7d531e8, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 12 2011 13:50:00 with gcc 4.6.2
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 43. 0 / 53. 43. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, image2, from 'basi4a08.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, gray8a, 32x32, 25 tbr, 25 tbn, 25 tbc
Incompatible pixel format 'gray8a' for codec 'bmp', auto-selecting format 'bgr24
'
[buffer @ 020D1700] w:32 h:32 pixfmt:gray8a tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 020D1980] auto-inserting filter 'auto-inserted scale 0' between th
e filter 'src' and the filter 'out'
[scale @ 020D1D80] w:32 h:32 fmt:gray8a -> w:32 h:32 fmt:bgr24 flags:0x4
Output #0, image2, to 'ffmpeg.bmp':
Metadata:
encoder : Lavf53.24.0
Stream #0:0: Video: bmp, bgr24, 32x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> bmp)
Press [q] to stop, [?] for help
frame= 1 fps= 0 q=0.0 Lsize= 0kB time=00:00:00.04 bitrate= 0.0kbits/
s
video:3kB audio:0kB global headers:0kB muxing overhead -100.000000%
C:\>ffplay basi4a08.png
ffplay version N-35709-g7d531e8, Copyright (c) 2003-2011 the FFmpeg developers
built on Dec 12 2011 13:50:00 with gcc 4.6.2
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 43. 0 / 53. 43. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, image2, from 'basi4a08.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, gray8a, 32x32, 25 tbr, 25 tbn, 25 tbc
[buffersink @ 020D2880] auto-inserting filter 'auto-inserted scale 0' between th
e filter 'src' and the filter 'out'
[scale @ 020D2CA0] w:32 h:32 fmt:gray8a -> w:32 h:32 fmt:yuv420p flags:0x4
1.44 A-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
comment:4 follow-up: ↓ 5 Changed 18 months ago by cehoyos
- Keywords gray8a alpha added
- Status changed from new to open
- Version changed from unspecified to git-master
- Component changed from undetermined to swscale
- Reproduced by developer set
The following commands work as expected:
ffmpeg -i basi4a08.png out.avi
ffmpeg -i basi4a08.png -pix_fmt yuv420p out.tif
comment:5 in reply to: ↑ 4 Changed 18 months ago by ami_stuff
Replying to cehoyos:
ffmpeg -i basi4a08.png -pix_fmt yuv420p out.tif
I can reproduce the problem with it (please see the attached output tif file), so maybe a bug in gray8a -> yuv420p conversion?
comment:6 Changed 18 months ago by cehoyos
Afaict, the conversion from gray8a to yuv (including yuv420p) is the only one that works (for gray8a).
out_yuv420p.tif looks fine with ImageMagick?.
comment:7 Changed 18 months ago by ami_stuff
I attache output from irfanview which I consider correct.
Now please create these files:
ffmpeg -loop 1 -t 5 -i basi4a08.png -vcodec rawvideo -pix_fmt rgba rgba.avi
ffmpeg -loop 1 -t 5 -i basi4a08.png -vcodec rawvideo -pix_fmt yuv420p yuv420p.avi
and play rgba.avi and yuv420p.avi with vlc.
rgba.avi will look more or less ok (there are still some strange black dots - something like flipped "F", but let's ignore it for now). yuv420p.avi will have vertical black lines, which is not correct.
comment:9 Changed 18 months ago by ami_stuff
attached pngs works with this:
} else if (s->bit_depth == 1) {
avctx->pix_fmt = PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
- avctx->pix_fmt = PIX_FMT_GRAY8A;
+ avctx->pix_fmt = PIX_FMT_GRAY16BE;
} else {
comment:10 Changed 17 months ago by cehoyos
- Keywords png added
gray_alpha.png was fixed by Michael, the transparency information of basi4a08.png gets lost with
ffmpeg -i basi4a08.png -pix_fmt rgba out.tif
comment:11 Changed 10 months ago by michael
- Status changed from open to closed
- Resolution set to fixed
Cant reproduce any of the mentioned issues anymore.
Also please try to keep 1 issue per bug report.
comment:12 Changed 10 months ago by cehoyos
The transparency information of basi4a08.png gets lost with the following command:
$ ffmpeg -i basi4a08.png -pix_fmt rgba out.png
ffmpeg version N-43716-g92b8c9d Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 18 2012 18:47:44 with gcc 4.6.1 (GCC)
configuration: --cc=/usr/local/gcc-4.6.1/bin/gcc
libavutil 51. 70.100 / 51. 70.100
libavcodec 54. 53.100 / 54. 53.100
libavformat 54. 25.104 / 54. 25.104
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 11.101 / 3. 11.101
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
Input #0, image2, from 'basi4a08.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, gray8a, 32x32, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'out.png':
Metadata:
encoder : Lavf54.25.104
Stream #0:0: Video: png, rgba, 32x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> png)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.04 bitrate= 0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000000%
comment:13 Changed 10 months ago by cehoyos
- Status changed from closed to reopened
- Resolution fixed deleted
comment:14 Changed 10 months ago by cehoyos
- Status changed from reopened to closed
- Resolution set to fixed
- Component changed from swscale to avcodec
One problem - that the decoded picture looked incorrect with ffplay - was fixed by Michael in January, I opened ticket #1702 for the remaining problem (that the transparency information of gray8a gets lost when converting to rgba).



