Answers.Body: <p>You have to add a pad with a label to the result of the overlay and feed that to concat. The <code>[1]</code> fed to concat refers to the source frames of the image sequence. And since the overlay result isn't labelled. It is included as the first output stream, with the wrong concat result being the 2nd.</p>
  
  <p>Use</p>
  
  <pre><code>-loop 1 -framerate 30000/1001 -i input0.png
          -framerate 30000/1001 -i input1_%04d.png
                                -i input2.mov
  -filter_complex "[0][1]overlay=shortest=1[ovl];[ovl][2]concat=n=2:v=1"
  -c:v libx264 -crf 18 output.mov
  </code></pre>
  
  <p>See <a href="http://ffmpeg.org/ffmpeg-filters.html#Filtergraph-description" rel="nofollow noreferrer">http://ffmpeg.org/ffmpeg-filters.html#Filtergraph-description</a> and  <a href="http://ffmpeg.org/ffmpeg.html#Stream-selection" rel="nofollow noreferrer">http://ffmpeg.org/ffmpeg.html#Stream-selection</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-08T20:03:25.843Z
Answers.Text: Thanks a bunch Gyan, this is just what I needed.
Answers.UserDisplayName: Spencer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-10T00:17:50.863Z
Answers.Text: @Spencer You need to think of `[0]` and `[1]` as variables, which *must* be sent to another variable if you run a filter on them then want to run further filters on the result. Gyan named that variable `[ov1]`. FFmpeg needs to be able to reference the output of any used filter if you want to run other filters on it, otherwise it will try to send it directly into the output file.
Answers.UserDisplayName: user3643
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-11T16:35:01.057Z
Answers.Text: @DigiVisionMedia thanks, makes sense
Answers.UserDisplayName: Spencer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-08T07:03:19.860Z
Answers.LastActivityDate: 2019-09-08T12:17:59.660Z
Answers.LastEditDate: 2019-09-08T12:17:59.660Z
Answers.UserDisplayName: Gyan
Body: <p>Here is what I am trying to accomplish in one FFmpeg process:</p>
  
  <ul>
  <li><p>A. Take in 3 inputs</p></li>
  <li><p>B. Overlay input 1 over input 0 (input 1 has an alpha channel)</p></li>
  <li><p>C. Take the result of step B and concatenate input 3 at the end</p></li>
  </ul>
  
  <p>Reading up on the documentation I was able to accomplish B and C independently, but when I try chaining them together into a complex filter I can accomplish overlaying input 0-1 but the concatenation does not seem to work. </p>
  
  <p>What it does is just freezing frame on the end of the overlaid clip, for the duration of input 3. In other words the output file has the correct duration, but instead of seeing input 3 at the end I just get a frozen frame at the end of input 2. Hopefully that is clear...</p>
  
  <p>Here is the command I am using:</p>
  
  <pre><code>-loop 1 -r 29.97 -i input0.png -r 29.97 -i input1_%04d.png -i input2.mov \
      -c:v libx264 -crf 18 -filter_complex "[0][1]overlay=shortest=1;[1][2]concat=n=2:v=1" 
       output.mov
  </code></pre>
  
  <p>I believe I am close enough, so hopefully this is just a simple tweak!</p>
  
Tags: <ffmpeg>
Title: Complex filtergraph
UserDisplayName: Spencer
ThreadText: # Complex filtergraph
  
  (Asked by: username_0 on 2019-09-08)
  
  Here is what I am trying to accomplish in one FFmpeg process:
  
  * A. Take in 3 inputs
  * B. Overlay input 1 over input 0 (input 1 has an alpha channel)
  * C. Take the result of step B and concatenate input 3 at the end
  
  Reading up on the documentation I was able to accomplish B and C independently, but when I try chaining them together into a complex filter I can accomplish overlaying input 0-1 but the concatenation does not seem to work.
  
  What it does is just freezing frame on the end of the overlaid clip, for the duration of input 3. In other words the output file has the correct duration, but instead of seeing input 3 at the end I just get a frozen frame at the end of input 2. Hopefully that is clear...
  
  Here is the command I am using:
  
  ```
  -loop 1 -r 29.97 -i input0.png -r 29.97 -i input1_%04d.png -i input2.mov \
      -c:v libx264 -crf 18 -filter_complex "[0][1]overlay=shortest=1;[1][2]concat=n=2:v=1" 
       output.mov
  
  ```
  
  I believe I am close enough, so hopefully this is just a simple tweak!
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-09-08. Score: 3 | Accepted answer
  
  You have to add a pad with a label to the result of the overlay and feed that to concat. The `[1]` fed to concat refers to the source frames of the image sequence. And since the overlay result isn't labelled. It is included as the first output stream, with the wrong concat result being the 2nd.
  
  Use
  
  ```
  -loop 1 -framerate 30000/1001 -i input0.png
          -framerate 30000/1001 -i input1_%04d.png
                                -i input2.mov
  -filter_complex "[0][1]overlay=shortest=1[ovl];[ovl][2]concat=n=2:v=1"
  -c:v libx264 -crf 18 output.mov
  
  ```
  
  See <http://ffmpeg.org/ffmpeg-filters.html#Filtergraph-description> and <http://ffmpeg.org/ffmpeg.html#Stream-selection>
  
  > **Comments:**
  > **username_0**: Thanks a bunch username_1, this is just what I needed.  
  > **username_2**: @username_0 You need to think of `[0]` and `[1]` as variables, which *must* be sent to another variable if you run a filter on them then want to run further filters on the result. username_1 named that variable `[ov1]`. FFmpeg needs to be able to reference the output of any used filter if you want to run other filters on it, otherwise it will try to send it directly into the output file.  
  > **username_0**: @DigiVisionMedia thanks, makes sense  
  
  ---
  
  