<p>Use</p>

<pre><code>for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)',scale=840:480[v]" -map [v] -map 0:a -codec:v libx264 -preset veryfast -crf 18 -codec:a copy "480\%%~nI.mkv"
</code></pre>

<p>All filters acting upon a stream should be within the same filtergraph.</p>

CC BY-SA 4.0
2018-06-29T12:41:08.110Z
`for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)',scale=840:480[v]" -map 0 -codec:v libx264 -preset veryfast -crf 18 "Temp480\%%~nI.mkv"`  I tried to change the code and tried to us this but id didn't worked
Dhrubajyoti Dutta
CC BY-SA 4.0
2018-06-29T12:48:58.653Z
You need to add `-map [v]` and change `-map 0` to `-map 0:a`
Gyan
CC BY-SA 4.0
2018-06-29T13:06:02.490Z
thanks mana... can you also look into this one https://superuser.com/questions/1335196/ffmpeg-error-when-renaming-batch-files?noredirect=1#comment1996749_1335196
Dhrubajyoti Dutta
CC BY-SA 4.0
2018-06-28T09:31:50.560Z
2018-06-28T09:31:50.560Z
Gyan
<p>I am trying to encode batch mkv videos which will give a output with a watermark in it.</p>

<p>But when I add the <code>-vf 840:480</code> or other resolution (like <strong>720p</strong> or <strong>1080p</strong>),
it don't run but without <code>-vf scale</code> it works fine but I need to set resolution for the video.</p>

<p><strong>Without -vf</strong></p>

<pre><code>for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -map 0 -vf scale=840:480 -codec:v libx264 -preset veryfast -crf 18 -codec:a copy "480\%%~nI.mkv"
</code></pre>

<p><strong>With -vf</strong></p>

<pre><code>for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -map 0 -vf scale=840:480 -codec:v libx264 -preset veryfast -crf 18 -codec:a copy "480\%%~nI.mkv"
</code></pre>

<p>Please help me with how to run the command with <code>-vf scale</code> </p>

<video><ffmpeg>
ffmpeg : error when added scale
Dhrubajyoti Dutta
# ffmpeg : error when added scale

(Asked by: username_0 on 2018-06-28)

I am trying to encode batch mkv videos which will give a output with a watermark in it.
But when I add the -vf 840:480 or other resolution (like 720p or 1080p),
it don't run but without -vf scale it works fine but I need to set resolution for the video.
Without -vf
for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -map 0 -vf scale=840:480 -codec:v libx264 -preset veryfast -crf 18 -codec:a copy "480\%%~nI.mkv"

With -vf
for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -map 0 -vf scale=840:480 -codec:v libx264 -preset veryfast -crf 18 -codec:a copy "480\%%~nI.mkv"

Please help me with how to run the command with -vf scale

**Tags:** video, ffmpeg


---

## 1 answers

### Answer by username_1 on 2018-06-28. Score: 0 | Accepted answer

Use
for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)',scale=840:480[v]" -map [v] -map 0:a -codec:v libx264 -preset veryfast -crf 18 -codec:a copy "480\%%~nI.mkv"

All filters acting upon a stream should be within the same filtergraph.

> **Comments:**
> **username_0**: `for %%I in ("*.mkv") do ffmpeg.exe -i "%%I" -i a.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)',scale=840:480[v]" -map 0 -codec:v libx264 -preset veryfast -crf 18 "Temp480\%%~nI.mkv"`  I tried to change the code and tried to us this but id didn't worked  
> **username_1**: You need to add `-map [v]` and change `-map 0` to `-map 0:a`  
> **username_0**: thanks mana... can you also look into this one https://superuser.com/questions/1335196/ffmpeg-error-when-renaming-batch-files?noredirect=1#comment1996749_1335196  

---

