<p>I am creating animated sequences from video files. I am hoping to create image masks from the video files to save time on masking them by hand. <a href="https://www.arj.no/2020/02/21/image-masks/" rel="nofollow noreferrer">This tutorial</a> seems to clearly outline the process, however I have not been able to successfully input this command:</p>
<pre><code>for i in *.tiff;
do
    name=`echo $i | cut -d'.' -f1';
    convert t01.tiff $i -compose difference -composite -threshold 5% -blur 0x3 \
          -threshold 20% -blur -0x3 &quot;$name-mask.tiff&quot; convert $i &quot;name-mask.tiff&quot; \
          -compose multiply -flatten &quot;$name-clean.jpg&quot;
done
</code></pre>
<p>When I enter this code, I receive:</p>
<pre><code>&gt;
</code></pre>
<p>I am using bash on Catalina and am a bit new to this workflow and command line in general.</p>

CC BY-SA 4.0
2021-05-29T04:21:43.830Z
Do you have two `convert` commands? Also, in your sample code you have `"name-mask.tiff"`, is the `$` missing? I would advice you use `${<varname>}` when using variables. It works everywhere and even if followed by a character which could be construed as a variable name character.
Alexis Wilke
CC BY-SA 4.0
2021-05-29T13:50:47.970Z
The problem is probably caused by line breaks when pasted in the terminal. Try creating a script instead. Read here: https://www.taniarascia.com/how-to-create-and-use-bash-scripts/
Matt
CC BY-SA 4.0
2021-05-29T14:57:22.583Z
@Matt This was the case! Followed the link, put the command in a script, worked as expected! Thank you!
tomlofredo
<ffmpeg><animation>
Batch processing in ImageMagick to create image masks from .mp4
tomlofredo
# Batch processing in ImageMagick to create image masks from .mp4

(Asked by: username_0 on 2021-05-28)

I am creating animated sequences from video files. I am hoping to create image masks from the video files to save time on masking them by hand. This tutorial seems to clearly outline the process, however I have not been able to successfully input this command:
for i in *.tiff;
do
    name=`echo $i | cut -d'.' -f1';
    convert t01.tiff $i -compose difference -composite -threshold 5% -blur 0x3 \
          -threshold 20% -blur -0x3 "$name-mask.tiff" convert $i "name-mask.tiff" \
          -compose multiply -flatten "$name-clean.jpg"
done

When I enter this code, I receive:
>

I am using bash on Catalina and am a bit new to this workflow and command line in general.

**Tags:** ffmpeg, animation

> **Comments:**
> **username_1**: Do you have two `convert` commands? Also, in your sample code you have `"name-mask.tiff"`, is the `$` missing? I would advice you use `${<varname>}` when using variables. It works everywhere and even if followed by a character which could be construed as a variable name character.  
> **username_2**: The problem is probably caused by line breaks when pasted in the terminal. Try creating a script instead. Read here: https://www.taniarascia.com/how-to-create-and-use-bash-scripts/  
> **username_0**: @username_2 This was the case! Followed the link, put the command in a script, worked as expected! Thank you!  

---

## 0 answers

