<p>Your command is attempting to place two streams into the GIF output (the output from paletteuse and the output from chromakey), but the GIF muxer supports only a single stream. To fix this your outputs from each filter should not be orphaned. See the <a href="https://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction" rel="nofollow noreferrer">filtering introduction</a> for more info.</p>

<pre><code>ffmpeg -i input.mp4 -filter_complex "[0:v]chromakey=0xE700F4,split[v0][v1];[v0]palettegen[p];[v1][p]paletteuse" output.gif
</code></pre>

<ul>
<li>For better results use the chromakey filter before creating the palette.</li>
<li>With the split filter you can avoid making a temporary palette file.</li>
</ul>

CC BY-SA 4.0
2019-07-11T00:07:43.720Z
That'll do it, thanks!
Alexwall
CC BY-SA 4.0
2019-07-10T22:59:54.497Z
2019-07-10T23:14:25.073Z
2019-07-10T23:14:25.073Z
llogan
<p>I have a video that has a color I'd like to remove, and make into a transparent gif with ffmpeg. I first created a color palette using </p>

<p><code>ffmpeg -i video.mp4 -filter_complex "[0:v] palettegen" palette.png</code>=</p>

<p>that went fine. Then when I go to try and make a gif I do this:</p>

<p><code>ffmpeg -i Untitled.mp4 -i palette.png -filter_complex "[0:v][1:v] paletteuse;[0:v]chromakey=0xE700F4" out.gif</code></p>

<p>This however gives an error and does not create anything. Am I doing something wrong here?</p>

<p>here's the log:</p>

<pre><code>  built with gcc 9.1.1 (GCC) 20190621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.101 /  7. 56.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Untitled.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 19529854
    compatible_brands: mp42isom
    creation_time   : 2019-07-10T05:06:10.000000Z
  Duration: 00:00:07.04, start: 0.000000, bitrate: 12629 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 190 kb/s (default)
    Metadata:
      creation_time   : 2019-07-10T05:06:10.000000Z
      handler_name    : Sound Media Handler
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 12433 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-07-10T05:06:10.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
Input #1, png_pipe, from 'palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:1 (h264) -&gt; paletteuse:default
  Stream #0:1 (h264) -&gt; chromakey
  Stream #1:0 (png) -&gt; paletteuse:palette
  paletteuse -&gt; Stream #0:0 (gif)
  chromakey -&gt; Stream #0:1 (gif)
Press [q] to stop, [?] for help
[swscaler @ 0000008b903fedc0] No accelerated colorspace conversion found from yuva420p to bgr8.
[gif @ 0000008b8ca40540] GIF muxer supports only a single video GIF stream.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
Conversion failed!
</code></pre>

CC BY-SA 4.0
2019-07-10T17:26:59.303Z
"gives an error" isn't descriptive and makes it hard to provide any help. You should always include the actual error. Even better is to provide the complete log from the command.
llogan
CC BY-SA 4.0
2019-07-10T22:37:53.193Z
alright i updated it
Alexwall
<ffmpeg><greenscreen>
ffmpeg greenscreen transparent while using color palette
Alexwall
# ffmpeg greenscreen transparent while using color palette

(Asked by: username_0 on 2019-07-10)

I have a video that has a color I'd like to remove, and make into a transparent gif with ffmpeg. I first created a color palette using 
ffmpeg -i video.mp4 -filter_complex "[0:v] palettegen" palette.png=
that went fine. Then when I go to try and make a gif I do this:
ffmpeg -i Untitled.mp4 -i palette.png -filter_complex "[0:v][1:v] paletteuse;[0:v]chromakey=0xE700F4" out.gif
This however gives an error and does not create anything. Am I doing something wrong here?
here's the log:
  built with gcc 9.1.1 (GCC) 20190621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.101 /  7. 56.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Untitled.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 19529854
    compatible_brands: mp42isom
    creation_time   : 2019-07-10T05:06:10.000000Z
  Duration: 00:00:07.04, start: 0.000000, bitrate: 12629 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 190 kb/s (default)
    Metadata:
      creation_time   : 2019-07-10T05:06:10.000000Z
      handler_name    : Sound Media Handler
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 12433 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-07-10T05:06:10.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
Input #1, png_pipe, from 'palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:1 (h264) -> paletteuse:default
  Stream #0:1 (h264) -> chromakey
  Stream #1:0 (png) -> paletteuse:palette
  paletteuse -> Stream #0:0 (gif)
  chromakey -> Stream #0:1 (gif)
Press [q] to stop, [?] for help
[swscaler @ 0000008b903fedc0] No accelerated colorspace conversion found from yuva420p to bgr8.
[gif @ 0000008b8ca40540] GIF muxer supports only a single video GIF stream.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
Conversion failed!

**Tags:** ffmpeg, greenscreen

> **Comments:**
> **username_1**: "gives an error" isn't descriptive and makes it hard to provide any help. You should always include the actual error. Even better is to provide the complete log from the command.  
> **username_0**: alright i updated it  

---

## 1 answers

### Answer by username_1 on 2019-07-10. Score: 1 | Accepted answer

Your command is attempting to place two streams into the GIF output (the output from paletteuse and the output from chromakey), but the GIF muxer supports only a single stream. To fix this your outputs from each filter should not be orphaned. See the filtering introduction for more info.
ffmpeg -i input.mp4 -filter_complex "[0:v]chromakey=0xE700F4,split[v0][v1];[v0]palettegen[p];[v1][p]paletteuse" output.gif


For better results use the chromakey filter before creating the palette.
With the split filter you can avoid making a temporary palette file.

> **Comments:**
> **username_0**: That'll do it, thanks!  

---

