<p>The issue is, that you reference the input file two times.  </p>

<pre><code>[1]scale=1612:906[inner];[0][inner]overlay=154:170;[1:v]colorkey=0x000000:0.02:0.03[ckout]
</code></pre>

<p>what you actually want is to use the scaled version. so:</p>

<pre><code>[1]scale=1612:906[inner];[0][inner]overlay=154:170[ovout]; [ovout]colorkey=0x000000:0.02:0.03[ckout];[0:v][ckout]overlay[out]
</code></pre>

<p>But I don't really understand why you overlay the image twice...
wouldn't this work?</p>

<pre><code>[1]colorkey=0x000000:0.02:0.03[ckout];[ckout]scale=1612:906[scaleout];[0][scaleout]overlay=154:170[out];
</code></pre>

<ol>
<li>colorkey, 2. scale, 3. overlay  </li>
</ol>

<p>You should almost always colorkey first and then scale to reduce colorkey artifacts</p>

<p>Greetings</p>

CC BY-SA 4.0
2020-05-25T11:47:58.797Z
2020-05-25T11:47:58.797Z
Pingger Shikkoken
<p>Having an issue with the chromakey portion not working after the scale. Any ideas?</p>

<p>ffmpeg -i background1080.png -i file.mp4 -filter_complex "[1]scale=1612:906[inner];[0][inner]overlay=154:170; [1:v]colorkey=0x000000:0.02:0.03[ckout];[0:v][ckout]overlay[out]" -map "[out]" -map 1:a -c:a copy -y -b:v 2000k -b:a 192k -vcodec libx264 -x264-params keyint=20:scenecut=0 -acodec copy file_FINAL.mp4</p>

CC BY-SA 4.0
2020-05-19T19:33:15.977Z
So this crops but the chroma-key doesn't work. If I remove the crop, the chroma key works - I think I'm just not understanding the syntax relationship fully for the [out] commands, etc.
Dot Matrix
<ffmpeg><chromakey><scale>
FFMPEG - Crop and Chromakey not working together?
Dot Matrix
# FFMPEG - Crop and Chromakey not working together?

(Asked by: username_0 on 2020-05-19)

Having an issue with the chromakey portion not working after the scale. Any ideas?

ffmpeg -i background1080.png -i file.mp4 -filter\_complex "[1]scale=1612:906[inner];[0][inner]overlay=154:170; [1:v]colorkey=0x000000:0.02:0.03[ckout];[0:v][ckout]overlay[out]" -map "[out]" -map 1:a -c:a copy -y -b:v 2000k -b:a 192k -vcodec libx264 -x264-params keyint=20:scenecut=0 -acodec copy file\_FINAL.mp4

**Tags:** ffmpeg, chromakey, scale

> **Comments:**
> **username_0**: So this crops but the chroma-key doesn't work. If I remove the crop, the chroma key works - I think I'm just not understanding the syntax relationship fully for the [out] commands, etc.  

---

## 1 answers

### Answer by username_1 on 2020-05-25. Score: 0

The issue is, that you reference the input file two times.  
[1]scale=1612:906[inner];[0][inner]overlay=154:170;[1:v]colorkey=0x000000:0.02:0.03[ckout]

what you actually want is to use the scaled version. so:
[1]scale=1612:906[inner];[0][inner]overlay=154:170[ovout]; [ovout]colorkey=0x000000:0.02:0.03[ckout];[0:v][ckout]overlay[out]

But I don't really understand why you overlay the image twice...
wouldn't this work?
[1]colorkey=0x000000:0.02:0.03[ckout];[ckout]scale=1612:906[scaleout];[0][scaleout]overlay=154:170[out];


colorkey, 2. scale, 3. overlay  

You should almost always colorkey first and then scale to reduce colorkey artifacts
Greetings


---

