<p>I decided to just try it out with an example video file and then compare the results I'm getting for each command.</p>
<p>First, we generate an example 5 seconds video file <code>example.mp4</code> for testing, counting from 1 to 5, showing each number for 1 second:</p>
<pre><code>for n in $(seq 1 5); do
  magick convert -size 200x200 xc:black -fill white -draw &quot;circle 100,100 100,200&quot; \( -background white -fill black -pointsize 200 label:&quot;$n&quot; -trim -resize 100x100 \) -gravity Center -composite &quot;$n.png&quot;
  ffmpeg -loop 1 -i &quot;$n.png&quot; -pix_fmt yuv420p -r 25 -t 1 &quot;$n.ts&quot;
done
ffmpeg -i &quot;concat:$(printf %s.ts\| $(seq 1 5))&quot; -c copy example.mp4
for n in $(seq 1 5); do
  rm &quot;$n.png&quot;
  rm &quot;$n.ts&quot;
done
</code></pre>
<p><a href="https://i.sstatic.net/eDSRe.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eDSRe.gif" alt="enter image description here" /></a></p>
<p>Next, we generate reference videos by applying the timestamp modifications sequentially, via an intermediary file:</p>
<ul>
<li><p>Applying an offset of 3 seconds, first, will lead to skipping numbers 1, 2 and 3 and remaining numbers 4 and 5 will be scaled to length of 3 seconds each:</p>
<pre><code>ffmpeg -itsoffset -3 -i example.mp4 -c copy itsoffset.mp4
ffmpeg -itsscale 3 -i itsoffset.mp4 -c copy itsoffset_itsscale.mp4
</code></pre>
<p><a href="https://i.sstatic.net/Yzey9.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Yzey9.gif" alt="enter image description here" /></a></p>
</li>
<li><p>Scaling to 3 seconds per number and subsequently adding an offset of 3 seconds will skip only number 1 in the final output:</p>
<pre><code>ffmpeg -itsscale 3 -i example.mp4 -c copy itsscale.mp4
ffmpeg -itsoffset -3 -i itsscale.mp4 -c copy itsscale_itsoffset.mp4
</code></pre>
<p><a href="https://i.sstatic.net/vexz8.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vexz8.gif" alt="enter image description here" /></a></p>
</li>
</ul>
<p>Finally, we can run the two different variants of the command to find out which output we're getting:</p>
<pre><code>  ffmpeg -itsoffset -3 -itsscale 3 -i example.mp4 -c copy test_itsoffset_itsscale.mp4
  ffmpeg -itsscale 3 -itsoffset -3 -i example.mp4 -c copy test_itsscale_itsoffset.mp4
</code></pre>
<p>Both commands lead to identical output files, which means that the order, in which they're mentioned in the command, doesn't matter. Furthermore, the resulting video shows that <strong>offset will be applied first, then scaling</strong>.</p>
<p><a href="https://i.sstatic.net/6rcrY.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6rcrY.gif" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2024-04-14T15:12:02.580Z
2024-04-14T15:12:02.580Z
finefoot
<p>I want to use both <code>-itsscale</code> and <code>-itsoffset</code> in my FFmpeg command, but couldn't find any information in the docs <a href="https://ffmpeg.org/ffmpeg.html" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg.html</a> or elsewhere, if the order, in which they're mentioned in the command, matters, or in which order they will generally be applied to the video.</p>

<ffmpeg><video><editing><timecode>
In which order do `-itsscale` and `-itsoffset` apply in my FFmpeg command?
finefoot
# In which order do `-itsscale` and `-itsoffset` apply in my FFmpeg command?

(Asked by: username_0 on 2024-04-14)

I want to use both `-itsscale` and `-itsoffset` in my FFmpeg command, but couldn't find any information in the docs <https://ffmpeg.org/ffmpeg.html> or elsewhere, if the order, in which they're mentioned in the command, matters, or in which order they will generally be applied to the video.

**Tags:** ffmpeg, video, editing, timecode


---

## 1 answers

### Answer by username_0 on 2024-04-14. Score: 2

I decided to just try it out with an example video file and then compare the results I'm getting for each command.
First, we generate an example 5 seconds video file example.mp4 for testing, counting from 1 to 5, showing each number for 1 second:
for n in $(seq 1 5); do
  magick convert -size 200x200 xc:black -fill white -draw "circle 100,100 100,200" \( -background white -fill black -pointsize 200 label:"$n" -trim -resize 100x100 \) -gravity Center -composite "$n.png"
  ffmpeg -loop 1 -i "$n.png" -pix_fmt yuv420p -r 25 -t 1 "$n.ts"
done
ffmpeg -i "concat:$(printf %s.ts\| $(seq 1 5))" -c copy example.mp4
for n in $(seq 1 5); do
  rm "$n.png"
  rm "$n.ts"
done


Next, we generate reference videos by applying the timestamp modifications sequentially, via an intermediary file:

Applying an offset of 3 seconds, first, will lead to skipping numbers 1, 2 and 3 and remaining numbers 4 and 5 will be scaled to length of 3 seconds each:
ffmpeg -itsoffset -3 -i example.mp4 -c copy itsoffset.mp4
ffmpeg -itsscale 3 -i itsoffset.mp4 -c copy itsoffset_itsscale.mp4



Scaling to 3 seconds per number and subsequently adding an offset of 3 seconds will skip only number 1 in the final output:
ffmpeg -itsscale 3 -i example.mp4 -c copy itsscale.mp4
ffmpeg -itsoffset -3 -i itsscale.mp4 -c copy itsscale_itsoffset.mp4




Finally, we can run the two different variants of the command to find out which output we're getting:
  ffmpeg -itsoffset -3 -itsscale 3 -i example.mp4 -c copy test_itsoffset_itsscale.mp4
  ffmpeg -itsscale 3 -itsoffset -3 -i example.mp4 -c copy test_itsscale_itsoffset.mp4

Both commands lead to identical output files, which means that the order, in which they're mentioned in the command, doesn't matter. Furthermore, the resulting video shows that offset will be applied first, then scaling.


---

