[FFmpeg-trac] #9602(avformat:new): When decoding apng the image has uncleaned parts.

FFmpeg trac at avcodec.org
Wed Jan 19 07:42:44 EET 2022


#9602: When decoding apng the image has uncleaned parts.
------------------------------------+--------------------------------------
             Reporter:  Ted Zyzsdy  |                     Type:  defect
               Status:  new         |                 Priority:  normal
            Component:  avformat    |                  Version:  git-master
             Keywords:  apng        |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+--------------------------------------
 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
 }}}

 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
 }}}

 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
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9602>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list