<p>Use</p>

<pre><code>ffmpeg -start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg 
       -framerate 30 -t 15.0 -i transition1_%03d.png
       -filter_complex "[0]loop=149:1:0[bgheld5];
                        [1]loop=149:1:0[fgheld5];
                        [bgheld5][fgheld5]overlay=eof_action=pass"  out.mp4
</code></pre>

<p>The first frames of both sequences are repeated 149 times, so that there are 150 instances (30 fps x 5s). The <code>0</code> at the end of loop is the starting index of the frame(s) to loop. The middle <code>1</code> is the number of frames to loop starting at the index in the 3rd argument.</p>

CC BY-SA 3.0
2018-03-08T12:42:45.093Z
Great, that's pretty much exactly what I was looking for.  The only difference is I don't need to loop the first input so my filter is "[1]loop=149:1:0[trans];[0][trans]overlay=eof_action=pass"
Nick Weeden
CC BY-SA 3.0
2018-03-08T11:11:22.727Z
2018-03-08T11:11:22.727Z
Gyan
<p>I'm trying to overlay a 15 second video transition on the beginning of an image sequence (png sequence with an alpha to reveal the image below), which I can do fine with the overlay filter.  But I want to hold the first frame of the image sequence for 5 seconds before playing the animation.  I've tried trim/select but I can't seem to get it be a duration of 5 seconds, I also can't seem to concat it back with the other video to do the transition. So my questions are:</p>

<ol>
<li>How do I get the first frame and hold it for 5 seconds, the method below works but doesn't seem like the best method? </li>
</ol>

<blockquote>
  <p>-start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg -framerate 30 -t 15.0 -i transition1_%03d.png -filter_complex "color=c=red:d=5:s=480x270:r=30[bg]; [bg][1:v]overlay[transhold]; [0:v][transhold]overlay=repeatlast=0[out]"</p>
</blockquote>

<ol start="2">
<li>Can I then easily concat that with the original or is it better to do two overlays with the start of the actual transition offset by the length of the hold?</li>
</ol>

<p>Thanks</p>

<p>Nick</p>

CC BY-SA 3.0
2018-03-08T11:09:25.883Z
For the 2nd question my code would look like this: -start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg -framerate 30 -t 15.0 -i transition1_%03d.png -filter_complex "color=c=red:d=5:s=480x270:r=30[bg]; [1:v]split[trans][transhold]; [trans]setpts=PTS+5/TB[trans];[transhold]select=eq(n\0)[transhold];[bg][transhold]overlay[transhold]; [0:v][transhold]overlay=repeatlast=0[tmp1]; [tmp1][trans]overlay[out]"
Nick Weeden
<video><ffmpeg><filter><programming>
FFMPEG, Extract first frame and hold for 5 seconds
Nick Weeden
# FFMPEG, Extract first frame and hold for 5 seconds

(Asked by: username_0 on 2018-03-08)

I'm trying to overlay a 15 second video transition on the beginning of an image sequence (png sequence with an alpha to reveal the image below), which I can do fine with the overlay filter. But I want to hold the first frame of the image sequence for 5 seconds before playing the animation. I've tried trim/select but I can't seem to get it be a duration of 5 seconds, I also can't seem to concat it back with the other video to do the transition. So my questions are:

1. How do I get the first frame and hold it for 5 seconds, the method below works but doesn't seem like the best method?

> -start\_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg -framerate 30 -t 15.0 -i transition1\_%03d.png -filter\_complex "color=c=red:d=5:s=480x270:r=30[bg]; [bg][1:v]overlay[transhold]; [0:v][transhold]overlay=repeatlast=0[out]"

2. Can I then easily concat that with the original or is it better to do two overlays with the start of the actual transition offset by the length of the hold?

Thanks

Nick

**Tags:** video, ffmpeg, filter, programming

> **Comments:**
> **username_0**: For the 2nd question my code would look like this: -start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg -framerate 30 -t 15.0 -i transition1_%03d.png -filter_complex "color=c=red:d=5:s=480x270:r=30[bg]; [1:v]split[trans][transhold]; [trans]setpts=PTS+5/TB[trans];[transhold]select=eq(n\0)[transhold];[bg][transhold]overlay[transhold]; [0:v][transhold]overlay=repeatlast=0[tmp1]; [tmp1][trans]overlay[out]"  

---

## 1 answers

### Answer by username_1 on 2018-03-08. Score: 1 | Accepted answer

Use
ffmpeg -start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg 
       -framerate 30 -t 15.0 -i transition1_%03d.png
       -filter_complex "[0]loop=149:1:0[bgheld5];
                        [1]loop=149:1:0[fgheld5];
                        [bgheld5][fgheld5]overlay=eof_action=pass"  out.mp4

The first frames of both sequences are repeated 149 times, so that there are 150 instances (30 fps x 5s). The 0 at the end of loop is the starting index of the frame(s) to loop. The middle 1 is the number of frames to loop starting at the index in the 3rd argument.

> **Comments:**
> **username_0**: Great, that's pretty much exactly what I was looking for.  The only difference is I don't need to loop the first input so my filter is "[1]loop=149:1:0[trans];[0][trans]overlay=eof_action=pass"  

---

