[FFmpeg-user] looping an animated gif

Michael Koch astroelectronic at t-online.de
Fri Jul 9 09:37:13 EEST 2021


Hello,

I want to overlay an animated gif over a video. The gif must be looped 
because it's much shorter than the video. I did try the "-loop 1" 
option, but I get the error message "Option loop not found". However, 
the loop option works fine for jpg images. How can an animated gif be 
looped?

ffmpeg -i background.MOV -loop 1 -i thumbsUp.gif -lavfi [0][1]overlay -t 
10 out.mp4

Michael


C:\Users\astro\Desktop>ffmpeg -i background.MOV -loop 1 -i thumbsUp.gif 
-lavfi [0][1]overlay -t 10 out.mp4
ffmpeg version 2021-07-04-git-301d275301-essentials_build-www.gyan.dev 
Copyright (c) 2000-2021 the FFmpeg developers
   built with gcc 10.3.0 (Rev2, 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-zlib --enable-libsrt --enable-libssh 
--enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp 
--enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom 
--enable-libopenjpeg --enable-libvpx --enable-libass 
--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-libgme 
--enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame 
--enable-libtheora --enable-libvo-amrwbenc --enable-libgsm 
--enable-libopencore-amrnb --enable-libopus --enable-libspeex 
--enable-libvorbis --enable-librubberband
   libavutil      57.  0.100 / 57.  0.100
   libavcodec     59.  3.100 / 59.  3.100
   libavformat    59.  4.100 / 59.  4.100
   libavdevice    59.  0.100 / 59.  0.100
   libavfilter     8.  0.103 /  8.  0.103
   libswscale      6.  0.100 /  6.  0.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b82af0e140] st: 0 edit list: 1 Missing 
key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b82af0e140] st: 0 edit list 1 Cannot 
find an index entry before timestamp: 1000.
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'background.MOV':
   Metadata:
     major_brand     : qt
     minor_version   : 537986816
     compatible_brands: qt  pana
     creation_time   : 2021-01-27T12:28:58.000000Z
     com.panasonic.Semi-Pro.metadata.xml: <?xml version="1.0" 
encoding="UTF-8" standalone="no" ?>
                     : <ClipMain 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="urn:schemas-Professional-Plug-in:Semi-Pro:ClipMetadata:v1.0">
                     :   <ClipContent>
                     : 
<GlobalClipID>060A2B340101010501010D2113000000BF61E24950BF563460541060C1650131</GlobalClipID>
                     :     <Duration>4056</Duration>
                     :     <EditUnit>1/24</EditUnit>
                     :     <EssenceList>
                     :       <Video>
                     :         <Codec BitRate="100">H264_420_LongGOP</Codec>
                     : <ActiveLine>1080</ActiveLine>
                     : <ActivePixel>1920</ActivePixel>
                     :         <BitDepth>8</BitDepth>
                     :         <FrameRate>24p</FrameRate>
                     :         <VFRRatio 
VRFRState="constant">24/180</VFRRatio>
                     : <TimecodeType>NonDrop</TimecodeType>
                     : <StartTimecode>17:30:54:21</StartTimecode>
                     :       </Video>
                     :       <Audio>
                     :         <Channel>2</Channel>
                     : <SamplingRate>48000</SamplingRate>
                     : <BitsPerSample>16</BitsPerSample>
                     :       </Audio>
                     :     </EssenceList>
                     :     <ClipMetadata>
                     :       <Rating>0</Rating>
                     :       <Access>
                     : 
<CreationDate>2021-01-27T12:28:58+02:00</CreationDate>
                     : 
<LastUpdateDate>2021-01-27T12:28:58+02:00</LastUpdateDate>
                     :       </Access>
                     :       <Device>
                     : <Manufacturer>Panasonic</Manufacturer>
                     : <ModelName>DC-GH5S</ModelName>
                     :       </Device>
                     :       <Shoot>
                     : <StartDate>2021-01-27T12:28:58+02:00</StartDate>
                     :       </Shoot>
                     :     </ClipMetadata>
                     :   </ClipContent>
                     :   <UserArea>
                     :     <AcquisitionMetadata 
xmlns="urn:schemas-Professional-Plug-in:P2:CameraMetadata:v1.2">
                     :       <CameraUnitMetadata>
                     :         <Gamma>
                     : <CaptureGamma>STANDARD</CaptureGamma>
                     :         </Gamma>
                     :         <Gamut>
                     : <CaptureGamut>BT.709</CaptureGamut>
                     :         </Gamut>
                     :       </CameraUnitMetadata>
                     :     </AcquisitionMetadata>
                     :   </UserArea>
                     : </ClipMain>
                     :
   Duration: 00:02:49.00, start: 0.000000, bitrate: 26146 kb/s
   Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, 
bt709), 1920x1080 [SAR 1:1 DAR 16:9], 24596 kb/s, 24 fps, 24 tbr, 24k 
tbn (default)
     Metadata:
       creation_time   : 2021-01-27T12:28:58.000000Z
       vendor_id       : [0][0][0][0]
       timecode        : 17:30:54:21
   Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 
stereo, s16, 1536 kb/s (default)
     Metadata:
       creation_time   : 2021-01-27T12:28:58.000000Z
       vendor_id       : pana
       timecode        : 17:30:54:21
   Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
     Metadata:
       creation_time   : 2021-01-27T12:28:58.000000Z
       timecode        : 17:30:54:21
Option loop not found.


More information about the ffmpeg-user mailing list