title: How to replace the video track of a part of a video file?
body: <p>I have an mp4 file like this(same format but longer):</p>
  
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'N1.2.mp4':
    Metadata:
      major_brand     : mp42
      minor_version   : 0
      compatible_brands: mp42mp41
      creation_time   : 2018-10-31T13:44:21.000000Z
    Duration: 00:28:54.21, start: 0.000000, bitrate: 10295 kb/s
      Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 9972 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc (default)
      Metadata:
        creation_time   : 2018-10-31T13:44:21.000000Z
        handler_name    : ?Mainconcept Video Media Handler
        encoder         : AVC Coding
      Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
      Metadata:
        creation_time   : 2018-10-31T13:44:21.000000Z
        handler_name    : #Mainconcept MP4 Sound Media Handler
  </code></pre>
  
  <p>I also have another video file that is 3 minutes long. and has no audio. What is the fastest way to encode the other video in a way that it is encoded like my main video and then replace the last three minutes of the video track of my original video with this?</p>
  
  <p>In other words.
  I have video A that is 1 hour long. With the encoding shown above.</p>
  
  <p>I have video B that is 3 minutes long with no audio. with a random encoding.</p>
  
  <p>I want to have video C with the same encoding and same audio as A. But it's video track would be the first 57 minutes of A + B(which is 3 minutes).</p>
  
  <p>I want to do this as fast as possible so I would like to not re encode A.</p>
  
  <p>I know how to concatenate two videos, I use this command:</p>
  
  <pre><code>ffmpeg -f concat -i files.txt -c copy res.mp4
  </code></pre>