[FFmpeg-user] Combine 2 small GIF images to small animated GIF, fails with "Decoder (codec none) not found for input stream #0:0"

Jim DeLaHunt from.ffmpeg-user at jdlh.com
Sun Jan 7 22:53:53 EET 2018


On 2018-01-07 00:16, Gyan Doshi wrote:

>
> GIFs have a dedicated demuxer and don't work via the image2 demuxer.

Thank you for your reply, Gyan.

Oh wow, this seems like a pretty significant limitation on the image2 
demuxer, and a deficiency in the documentation that this isn't 
mentioned. I've filed a ticket about deficiencies in the image2 
documentation.[1]

It seems this is a restriction on the input format. GIF inputs don't 
work even to a non-GIF output.[2]

> Try the concat demuxer, or ingest the two GIFs separately and use the 
> concat filter.

Well, the easiest workaround seems to be, convert the input images from 
GIF to PNG format, then `ffmpeg -f image2` to combine them to a video.[3]

But I was also able to make the `concat` filter work.[4]

Thank you for your help, Gyan!  Best regards,
       —Jim DeLaHunt, Vancouver, Canada

[1] https://trac.ffmpeg.org/ticket/6950#ticket
[2] GIF inputs don't work even to a non-GIF output.

% ffmpeg -f image2 -i blue_%d.gif animated_blue_12.mp4

ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers

   built with Apple LLVM version 8.0.0 (clang-800.0.42.1)

   configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid

   libavutil      55. 78.100 / 55. 78.100

   libavcodec     57.107.100 / 57.107.100

   libavformat    57. 83.100 / 57. 83.100

   libavdevice    57. 10.100 / 57. 10.100

   libavfilter     6.107.100 /  6.107.100

   libavresample   3.  7.  0 /  3.  7.  0

   libswscale      4.  8.100 /  4.  8.100

   libswresample   2.  9.100 /  2.  9.100

   libpostproc    54.  7.100 / 54.  7.100

[image2 @ 0x7f9ba4808000] Could not find codec parameters for stream 0 (Video: none, none): unknown codec

Consider increasing the value for the 'analyzeduration' and 'probesize' options

Input #0, image2, from 'blue_%d.gif':

   Duration: 00:00:00.08, start: 0.000000, bitrate: N/A

     Stream #0:0: Video: none, none, 25 tbr, 25 tbn, 25 tbc

Stream mapping:

   Stream #0:0 -> #0:0 (? (?) -> h264 (libx264))

Decoder (codec none) not found for input stream #0:0


[3] The image2 demuxer is effective at combining non-GIF inputs (here, 
PNG) into an animated GIF video output

% ffmpeg -f image2 -i blue_%d.png animated_blue_12_from_png.gif

ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers

   built with Apple LLVM version 8.0.0 (clang-800.0.42.1)

   configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid

   libavutil      55. 78.100 / 55. 78.100

   libavcodec     57.107.100 / 57.107.100

   libavformat    57. 83.100 / 57. 83.100

   libavdevice    57. 10.100 / 57. 10.100

   libavfilter     6.107.100 /  6.107.100

   libavresample   3.  7.  0 /  3.  7.  0

   libswscale      4.  8.100 /  4.  8.100

   libswresample   2.  9.100 /  2.  9.100

   libpostproc    54.  7.100 / 54.  7.100

Input #0, image2, from 'blue_%d.png':

   Duration: 00:00:00.08, start: 0.000000, bitrate: N/A

     Stream #0:0: Video: png, pal8(pc), 212x318, 25 tbr, 25 tbn, 25 tbc

Stream mapping:

   Stream #0:0 -> #0:0 (png (native) -> gif (native))

Press [q] to stop, [?] for help

Output #0, gif, to 'animated_blue_12_from_png.gif':

   Metadata:

     encoder         : Lavf57.83.100

     Stream #0:0: Video: gif, pal8, 212x318, q=2-31, 200 kb/s, 25 fps, 100 tbn, 25 tbc

     Metadata:

       encoder         : Lavc57.107.100 gif

frame=    2 fps=0.0 q=-0.0 Lsize=       3kB time=00:00:00.05 bitrate= 423.8kbits/s speed=9.25x

video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 44.596069%


[4] The concat filter is effective in combining GIF inputs into a video 
output, here animated GIF output.

% ffmpeg -i blue_1.gif -i blue_2.gif -filter_complex "[0:v][1:v] concat=n=2:v=1:a=0" -y animated_blue_12.gif

ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers

   built with Apple LLVM version 8.0.0 (clang-800.0.42.1)

   configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid

   libavutil      55. 78.100 / 55. 78.100

   libavcodec     57.107.100 / 57.107.100

   libavformat    57. 83.100 / 57. 83.100

   libavdevice    57. 10.100 / 57. 10.100

   libavfilter     6.107.100 /  6.107.100

   libavresample   3.  7.  0 /  3.  7.  0

   libswscale      4.  8.100 /  4.  8.100

   libswresample   2.  9.100 /  2.  9.100

   libpostproc    54.  7.100 / 54.  7.100

Input #0, gif, from 'blue_1.gif':

   Duration: N/A, bitrate: N/A

     Stream #0:0: Video: gif, bgra, 212x318, 10 tbr, 100 tbn, 100 tbc

Input #1, gif, from 'blue_2.gif':

   Duration: N/A, bitrate: N/A

     Stream #1:0: Video: gif, bgra, 212x318, 10 tbr, 100 tbn, 100 tbc

Stream mapping:

   Stream #0:0 (gif) -> concat:in0:v0

   Stream #1:0 (gif) -> concat:in1:v0

   concat -> Stream #0:0 (gif)

Press [q] to stop, [?] for help

Output #0, gif, to 'animated_blue_12.gif':

   Metadata:

     encoder         : Lavf57.83.100

     Stream #0:0: Video: gif, bgr8, 212x318, q=2-31, 200 kb/s, 10 fps, 100 tbn, 10 tbc (default)

     Metadata:

       encoder         : Lavc57.107.100 gif

frame=    2 fps=0.0 q=-0.0 Lsize=       1kB time=00:00:00.11 bitrate= 102.7kbits/s speed=24.9x

video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 137.310928%



-- 
     --Jim DeLaHunt, jdlh at jdlh.com     http://blog.jdlh.com/ (http://jdlh.com/)
       multilingual websites consultant

       355-1027 Davie St, Vancouver BC V6E 4L2, Canada
          Canada mobile +1-604-376-8953



More information about the ffmpeg-user mailing list