Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#6256 closed defect (invalid)

Showpalette filter returns default palette for GIF.

Reported by: mulvya Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: gif regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

For the GIF file attached, the showpalette filter returns the default palette. The palettegen filter, in effect, reproduces the embedded palette. See attached PNGs.

Showpalette (only run for 1 frame, but outputting to image sequence has same result):

ffmpeg started on 2017-03-23 at 16:16:47
Report written to "ffmpeg-20170323-161647.log"
Command line:
ffmpeg -i bbb-nodither.gif -vf showpalette -vframes 1 showpalette.png -report
ffmpeg version N-84049-gde1308429a Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Rev2, Built by MSYS2 project)
  configuration:  --enable-avisynth --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-cuda --enable-cuvid --enable-schannel --enable-decklink --enable-fontconfig --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmfx --enable-libmodplug --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libwebp --enable-libxavs --enable-libxvid --enable-libzimg --enable-openssl --enable-libsnappy --enable-gpl --enable-opencl --enable-opengl --enable-libcdio --enable-libfdk-aac --enable-libkvazaar --enable-librubberband --enable-libssh --enable-libtesseract --enable-libzvbi --enable-chromaprint --enable-libopenh264 --en  libavutil      55. 48.100 / 55. 48.100
  libavcodec     57. 83.100 / 57. 83.100
  libavformat    57. 66.104 / 57. 66.104
  libavdevice    57.  3.100 / 57.  3.100
  libavfilter     6. 77.100 /  6. 77.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'bbb-nodither.gif'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'showpalette'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'.
Reading option 'showpalette.png' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url bbb-nodither.gif.
Successfully parsed a group of options.
Opening an input file: bbb-nodither.gif.
[file @ 00000000004aa720] Setting default whitelist 'file,crypto'
[gif @ 00000000004a8fe0] Format gif probed with size=2048 and score=100
[gif @ 00000000004a8fe0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[gif @ 00000000004a8fe0] rfps: 23.833333 0.012814
[gif @ 00000000004a8fe0] rfps: 23.916667 0.006566
[gif @ 00000000004a8fe0] rfps: 24.000000 0.004757
[gif @ 00000000004a8fe0] rfps: 24.083333 0.007388
[gif @ 00000000004a8fe0] rfps: 24.166667 0.014459
[gif @ 00000000004a8fe0] rfps: 48.000000 0.019029
[gif @ 00000000004a8fe0] rfps: 52.000000 0.019029
[gif @ 00000000004a8fe0] rfps: 23.976024 0.004823
[gif @ 00000000004a8fe0] rfps: 47.952048 0.019291
[gif @ 00000000004a8fe0] After avformat_find_stream_info() pos: 1036665 bytes read:2598949 seeks:2 frames:48
Input #0, gif, from 'bbb-nodither.gif':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 48, 1/100: Video: gif, bgra, 300x169, 23.98 fps, 24 tbr, 100 tbn, 100 tbc
Successfully opened the file.
Parsing a group of options: output url showpalette.png.
Applying option vf (set video filters) with argument showpalette.
Applying option vframes (set the number of video frames to output) with argument 1.
Successfully parsed a group of options.
Opening an output file: showpalette.png.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (gif (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 00000000031852e0] code=21 '!'
[gif @ 00000000031852e0] code=21 '!'
[gif @ 00000000031852e0] code=2c ','
detected 4 logical cores
[graph 0 input from stream 0:0 @ 00000000004ad1e0] Setting 'video_size' to value '300x169'
[graph 0 input from stream 0:0 @ 00000000004ad1e0] Setting 'pix_fmt' to value '30'
[graph 0 input from stream 0:0 @ 00000000004ad1e0] Setting 'time_base' to value '1/100'
[graph 0 input from stream 0:0 @ 00000000004ad1e0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 00000000004ad1e0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 00000000004ad1e0] Setting 'frame_rate' to value '24/1'
[graph 0 input from stream 0:0 @ 00000000004ad1e0] w:300 h:169 pixfmt:bgra tb:1/100 fr:24/1 sar:0/1 sws_param:flags=2
[format @ 00000000004ad9c0] compat: called with args=[rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob]
[format @ 00000000004ad9c0] Setting 'pix_fmts' to value 'rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob'
[auto_scaler_0 @ 00000000004ae240] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 00000000004ae240] w:iw h:ih flags:'bicubic' interl:0
[Parsed_showpalette_0 @ 00000000004ac840] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_showpalette_0'
[auto_scaler_1 @ 0000000003ad4000] Setting 'flags' to value 'bicubic'
[auto_scaler_1 @ 0000000003ad4000] w:iw h:ih flags:'bicubic' interl:0
[format @ 00000000004ad9c0] auto-inserting filter 'auto_scaler_1' between the filter 'Parsed_showpalette_0' and the filter 'format'
[AVFilterGraph @ 00000000031ea920] query_formats: 4 queried, 1 merged, 2 already done, 0 delayed
[auto_scaler_1 @ 0000000003ad4000] picking rgba out of 9 ref:bgra alpha:1
[swscaler @ 0000000003adcfc0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 00000000004ae240] w:300 h:169 fmt:bgra sar:0/1 -> w:300 h:169 fmt:pal8 sar:0/1 flags:0x4
[swscaler @ 0000000003afc420] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_1 @ 0000000003ad4000] w:480 h:480 fmt:bgra sar:0/1 -> w:480 h:480 fmt:rgba sar:0/1 flags:0x4
Output #0, image2, to 'showpalette.png':
  Metadata:
    encoder         : Lavf57.66.104
    Stream #0:0, 0, 1/24: Video: png, rgba, 480x480, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
    Metadata:
      encoder         : Lavc57.83.100 png
Clipping frame in rate conversion by 0.000008
No more output streams to write to, finishing.
[file @ 0000000003ad0320] Setting default whitelist 'file,crypto'
[AVIOContext @ 0000000003b15780] Statistics: 0 seeks, 1 writeouts
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.316x    
video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (bbb-nodither.gif):
  Input stream #0:0 (video): 1 packets read (38262 bytes); 1 frames decoded; 
  Total: 1 packets (38262 bytes) demuxed
Output file #0 (showpalette.png):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (5567 bytes); 
  Total: 1 packets (5567 bytes) muxed
1 frames successfully decoded, 0 decoding errors
[AVIOContext @ 000000000317bfe0] Statistics: 2598949 bytes read, 2 seeks

Palettegen:

ffmpeg started on 2017-03-23 at 16:19:03
Report written to "ffmpeg-20170323-161903.log"
Command line:
ffmpeg -i bbb-nodither.gif -vf "palettegen,scale=30*iw:-1:flags=neighbor" palettegen.png -report
ffmpeg version N-84049-gde1308429a Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Rev2, Built by MSYS2 project)
  configuration:  --enable-avisynth --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-cuda --enable-cuvid --enable-schannel --enable-decklink --enable-fontconfig --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmfx --enable-libmodplug --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libwebp --enable-libxavs --enable-libxvid --enable-libzimg --enable-openssl --enable-libsnappy --enable-gpl --enable-opencl --enable-opengl --enable-libcdio --enable-libfdk-aac --enable-libkvazaar --enable-librubberband --enable-libssh --enable-libtesseract --enable-libzvbi --enable-chromaprint --enable-libopenh264 --en  libavutil      55. 48.100 / 55. 48.100
  libavcodec     57. 83.100 / 57. 83.100
  libavformat    57. 66.104 / 57. 66.104
  libavdevice    57.  3.100 / 57.  3.100
  libavfilter     6. 77.100 /  6. 77.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'bbb-nodither.gif'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'palettegen,scale=30*iw:-1:flags=neighbor'.
Reading option 'palettegen.png' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url bbb-nodither.gif.
Successfully parsed a group of options.
Opening an input file: bbb-nodither.gif.
[file @ 000000000054a940] Setting default whitelist 'file,crypto'
[gif @ 0000000000549200] Format gif probed with size=2048 and score=100
[gif @ 0000000000549200] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[gif @ 0000000000549200] rfps: 23.833333 0.012814
[gif @ 0000000000549200] rfps: 23.916667 0.006566
[gif @ 0000000000549200] rfps: 24.000000 0.004757
[gif @ 0000000000549200] rfps: 24.083333 0.007388
[gif @ 0000000000549200] rfps: 24.166667 0.014459
[gif @ 0000000000549200] rfps: 48.000000 0.019029
[gif @ 0000000000549200] rfps: 52.000000 0.019029
[gif @ 0000000000549200] rfps: 23.976024 0.004823
[gif @ 0000000000549200] rfps: 47.952048 0.019291
[gif @ 0000000000549200] After avformat_find_stream_info() pos: 1036665 bytes read:2598949 seeks:2 frames:48
Input #0, gif, from 'bbb-nodither.gif':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 48, 1/100: Video: gif, bgra, 300x169, 23.98 fps, 24 tbr, 100 tbn, 100 tbc
Successfully opened the file.
Parsing a group of options: output url palettegen.png.
Applying option vf (set video filters) with argument palettegen,scale=30*iw:-1:flags=neighbor.
Successfully parsed a group of options.
Opening an output file: palettegen.png.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (gif (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
detected 4 logical cores
[Parsed_scale_1 @ 000000000054d560] Setting 'w' to value '30*iw'
[Parsed_scale_1 @ 000000000054d560] Setting 'h' to value '-1'
[Parsed_scale_1 @ 000000000054d560] Setting 'flags' to value 'neighbor'
[Parsed_scale_1 @ 000000000054d560] w:30*iw h:-1 flags:'neighbor' interl:0
[graph 0 input from stream 0:0 @ 00000000039cf260] Setting 'video_size' to value '300x169'
[graph 0 input from stream 0:0 @ 00000000039cf260] Setting 'pix_fmt' to value '30'
[graph 0 input from stream 0:0 @ 00000000039cf260] Setting 'time_base' to value '1/100'
[graph 0 input from stream 0:0 @ 00000000039cf260] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 00000000039cf260] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 00000000039cf260] Setting 'frame_rate' to value '24/1'
[graph 0 input from stream 0:0 @ 00000000039cf260] w:300 h:169 pixfmt:bgra tb:1/100 fr:24/1 sar:0/1 sws_param:flags=2
[format @ 00000000039cf7e0] compat: called with args=[rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob]
[format @ 00000000039cf7e0] Setting 'pix_fmts' to value 'rgb24|rgba|rgb48be|rgba64be|pal8|gray|ya8|gray16be|ya16be|monob'
[AVFilterGraph @ 000000000306a940] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[Parsed_scale_1 @ 000000000054d560] picking rgba out of 9 ref:bgra alpha:1
[swscaler @ 00000000039d8fc0] Forcing full internal H chroma due to input having non subsampled chroma
[Parsed_scale_1 @ 000000000054d560] w:16 h:16 fmt:bgra sar:1/1 -> w:480 h:480 fmt:rgba sar:1/1 flags:0x10
Output #0, image2, to 'palettegen.png':
  Metadata:
    encoder         : Lavf57.66.104
    Stream #0:0, 0, 1/24: Video: png, rgba, 480x480 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
    Metadata:
      encoder         : Lavc57.83.100 png
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gif @ 0000000003005320] code=21 '!'
[gif @ 0000000003005320] code=2c ','
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[Parsed_palettegen_0 @ 000000000054cea0] 255(+1) colors generated out of 255 colors; ratio=1.000000
[swscaler @ 00000000039ee880] Forcing full internal H chroma due to input having non subsampled chroma
[Parsed_scale_1 @ 000000000054d560] w:16 h:16 fmt:bgra sar:0/1 -> w:480 h:480 fmt:rgba sar:0/1 flags:0x10
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
No more output streams to write to, finishing.
[file @ 00000000039d2300] Setting default whitelist 'file,crypto'
[AVIOContext @ 000000000054fca0] Statistics: 0 seeks, 1 writeouts
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.486x    
video:6kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (bbb-nodither.gif):
  Input stream #0:0 (video): 48 packets read (1036664 bytes); 48 frames decoded; 
  Total: 48 packets (1036664 bytes) demuxed
Output file #0 (palettegen.png):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (6007 bytes); 
  Total: 1 packets (6007 bytes) muxed
48 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000000002ffc020] Statistics: 2598949 bytes read, 2 seeks

Attachments (1)

bbb-nodither.gif (1012.4 KB) - added by mulvya 3 months ago.
source GIF

Download all attachments as: .zip

Change History (7)

Changed 3 months ago by mulvya

source GIF

comment:1 Changed 3 months ago by mulvya

See question on Stack Overflow that prompted this ticket. FFmpeg did not identify the GIFs as pal8 but the OP checked the palette in the GIF starting at offset 0xD.

comment:2 Changed 3 months ago by cehoyos

  • Keywords gif regression added

If there were an issue, this would be a regression since 91499f4ee825502677dfc11b00205538720d0513

But FFmpeg does not guarantee to output a particular colour space for a given file (as it does not guarantee a particular audio sample format when decoding a given file), this behaviour isn't part of the API/ABI (this is why API users always have to check the pix_fmt and sample_fmts that encoders need / decoders provide). Note that decoding of the provided file only works since f83657fc, four commits after the requested feature was "broken" / the reported "bug" was introduced.
From FFmpeg's pov, the provided file is not palettized, to get a palette for the given (bgra) file, using the palettegen filter is required. Using the showpalette filter for a file that isn't palettized will show a default filter.

Not closing yet as I don't know if changing the current behaviour of the gif decoder / demuxer is possible or not, this may be a valid feature request.

For future tickets: Please do not provide output files unless specifically asked to, attaching them very often leads to confusion.

comment:3 Changed 3 months ago by mulvya

The reason I believe that this GIF is likely palettized is because the source GIF is provided as an output demo of the palettegen/use filters, and is taken from the blog of ubitux who authored those filters. See the section on 'Color mapping and dithering'.

comment:4 Changed 3 months ago by ubitux

Heh.

I believe this is because the Gif decoder outputs RGB instead of PAL8. This is technically a regression since 91499f4ee825502677dfc11b00205538720d0513. I don't remember the rationale behind this decision, but I'd love to see the decoder output PAL8 again.

comment:5 Changed 3 months ago by ubitux

  • Component changed from undetermined to avcodec
  • Keywords regression removed
  • Resolution set to invalid
  • Status changed from new to closed

Actually, we may not be able to switch back to PAL8 because a frame can be composed over time with the use of multiple different palettes. And even a single image could be composed of pixels from multiple palettes...

comment:6 Changed 3 months ago by cehoyos

  • Keywords regression added
Note: See TracTickets for help on using tickets.