Opened 3 years ago
Closed 2 years ago
#9602 closed defect (fixed)
When decoding apng the image has uncleaned parts.
Reported by: | Ted Zyzsdy | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avcodec |
Version: | git-master | Keywords: | apng regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug:
I need to convert the format of a set of apng files to gif. But I found in the conversion result that part of the image was not cleaned properly, but overlapped on top of the canvas. To determine whether the problem was in decoding apng or encoding gif, I converted the apng as a sequence of jpeg images and still found the same problem.
Then, I checked at the apng file, and in the fcTL block at frame 7, the dispose_op is marked as 0x01 APNG_DISPOSE_OP_BACKGROUND, indicating that the background needs to be cleared before the frame is rendered, but ffmpeg doesn't actually do that.
How to reproduce:
% ffmpeg.exe -i apng_image_uncleaned_part.png -f image2 de-%03d.jpg ffmpeg version 2022-01-17-git-dcc9454ab9-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.0 (Rev5, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 57. 18.100 / 57. 18.100 libavcodec 59. 20.100 / 59. 20.100 libavformat 59. 17.101 / 59. 17.101 libavdevice 59. 5.100 / 59. 5.100 libavfilter 8. 25.100 / 8. 25.100 libswscale 6. 5.100 / 6. 5.100 libswresample 4. 4.100 / 4. 4.100 libpostproc 56. 4.100 / 56. 4.100 Input #0, apng, from 'apng_image_uncleaned_part.png': Duration: N/A, bitrate: N/A Stream #0:0: Video: apng, rgba(pc), 370x300, 20 fps, 20 tbr, 100k tbn Stream mapping: Stream #0:0 -> #0:0 (apng (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 00000264be1f9280] [swscaler @ 00000264be206240] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be219600] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be446340] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be81dfc0] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be83afc0] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be8594c0] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be8800c0] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be8adcc0] deprecated pixel format used, make sure you did set range correctly [swscaler @ 00000264be1f9280] [swscaler @ 00000264be8cdcc0] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'de-%03d.jpg': Metadata: encoder : Lavf59.17.101 Stream #0:0: Video: mjpeg, yuvj444p(pc, progressive), 370x300, q=2-31, 200 kb/s, 20 fps, 20 tbn Metadata: encoder : Lavc59.20.100 mjpeg Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A frame= 20 fps=0.0 q=24.8 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=19.9x video:236kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
However, when I try to convert with an older version of ffmpeg 4.3.1 downloaded the year before, this problem does not exist.
% ffmpeg.exe -i apng_image_uncleaned_part.png -f image2 de-%03d.jpg ffmpeg version 4.3.1-2020-11-08-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10.2.0 (Rev3, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, apng, from 'apng_image_uncleaned_part.png': Duration: N/A, bitrate: N/A Stream #0:0: Video: apng, rgba(pc), 370x300, 20 fps, 20 tbr, 100k tbn, 100k tbc Stream mapping: Stream #0:0 -> #0:0 (apng (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 000002071a438f80] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'de-%03d.jpg': Metadata: encoder : Lavf58.45.100 Stream #0:0: Video: mjpeg, yuvj444p(pc), 370x300, q=2-31, 200 kb/s, 20 fps, 20 tbn, 20 tbc Metadata: encoder : Lavc58.91.100 mjpeg Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A frame= 20 fps=0.0 q=24.8 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=17.6x video:233kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
This version outputs the expected result.
The original apng file uploaded as attachment apng_image_uncleaned_part.png
Expected result (frame 7) uploaded as attachment apng_uncleaned_part_frame_7_expected_result.jpg
The problem result (frame 7) uploaded as attachment apng_uncleaned_part_frame_7_defected_result.jpg
Attachments (3)
Change History (5)
by , 3 years ago
Attachment: | apng_image_uncleaned_part.png added |
---|
by , 3 years ago
Attachment: | apng_uncleaned_part_frame_7_defected_result.jpg added |
---|
by , 3 years ago
Attachment: | apng_uncleaned_part_frame_7_expected_result.jpg added |
---|
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
comment:2 by , 2 years ago
Component: | avformat → avcodec |
---|---|
Keywords: | regression added |
Priority: | normal → important |
Resolution: | → fixed |
Status: | new → closed |
Fixed in a84087eaf8b806380dc8d50ea367816b12b99580.