Answers.Body: <p>I know how to do it in three steps.
  Separate your main video.</p>
  <p>Step 1. Trim the end.</p>
  <p><code>ffmpeg -i main.mkv -c copy -t 00:02:00 main-intro.mkv</code></p>
  <p>Step 2. Trim the start.</p>
  <p><code>ffmpeg -i main.mkv -c copy -ss 00:02:00 main-outro.mkv</code></p>
  <p>Step 3. Concatenate them with your trailer file.</p>
  <p><code>ffmpeg -safe 0 -i &quot;concat:main-intro.mkv|trailer.mkv|main-outro.mkv&quot; -c copy output.mkv</code></p>
  <p>You can write script and you will have opportunity to do it in one click.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-13T08:39:03.810Z
Answers.LastActivityDate: 2021-11-13T08:39:03.810Z
Answers.UserDisplayName: Viktor Liashenko
Body: <p>I have two videos of the same format encoded with the same codecs. I want <strong>trailer.mkv</strong> to be played after <code>n</code> minutes in the middle of <strong>main.mkv</strong>. After playing <strong>trailer.mkv</strong>, the rest of the <strong>main.mkv</strong> will continue playing. How can I concatenate them?</p>
  
Tags: <ffmpeg><video><linux><concatenation>
Title: How to put a trailer clip in the middle of the main video with FFMPEG?
UserDisplayName: Nick
ThreadText: # How to put a trailer clip in the middle of the main video with FFMPEG?
  
  (Asked by: username_0 on 2021-11-12)
  
  I have two videos of the same format encoded with the same codecs. I want **trailer.mkv** to be played after `n` minutes in the middle of **main.mkv**. After playing **trailer.mkv**, the rest of the **main.mkv** will continue playing. How can I concatenate them?
  
  **Tags:** ffmpeg, video, linux, concatenation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-13. Score: 1
  
  I know how to do it in three steps.
  Separate your main video.
  
  Step 1. Trim the end.
  
  `ffmpeg -i main.mkv -c copy -t 00:02:00 main-intro.mkv`
  
  Step 2. Trim the start.
  
  `ffmpeg -i main.mkv -c copy -ss 00:02:00 main-outro.mkv`
  
  Step 3. Concatenate them with your trailer file.
  
  `ffmpeg -safe 0 -i "concat:main-intro.mkv|trailer.mkv|main-outro.mkv" -c copy output.mkv`
  
  You can write script and you will have opportunity to do it in one click.
  
  
  ---
  
  