Answers.Body: <p>You can just use the protocol</p>
  
  <pre><code>ffmpeg -i "concat:in1.ts|in2.ts|in3.ts" -c:v libx264 -r 30000/1001 -vf scale=640:480 -aspect 4:3 -preset slow -crf 22 output.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-08T04:56:47.407Z
Answers.LastActivityDate: 2017-01-08T04:56:47.407Z
Answers.UserDisplayName: Gyan
Body: <p>I have several similarly-encoded <code>.ts</code> video files that I would like to concatenate and encode into a single <code>.mp4</code> file.</p>
  
  <p>The <code>.ts</code> files look like</p>
  
  <pre><code>Input #0, mpegts, from 'input1.ts':
    Duration: 00:01:24.14, start: 0.066778, bitrate: 15941 kb/s
    Program 1 
      Stream #0:0[0x44]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
      Stream #0:1[0x45]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 251 kb/s
  </code></pre>
  
  <p>The output should be 640x480, 29.97fps video. (The <code>.ts</code> files contain digitized old <a href="https://en.wikipedia.org/wiki/8_mm_video_format#Hi8" rel="nofollow noreferrer">Hi8</a> camcorder video, digitized at a much-too-generous bitrate &amp; resolution for the Hi8 video format.)</p>
  
  <p>I can encode a single <code>.ts</code> file like this:</p>
  
  <pre><code>$ ffmpeg -i input1.ts -c:v libx264 -vf scale=640:480 -aspect 4:3 -preset slow -crf 22 -r 29.97 output.mp4
  </code></pre>
  
  <p><strong>What is the correct way to concatenate several <code>.ts</code> files into a single <code>.mp4</code> without creating a huge intermediate <code>.ts</code> file?</strong></p>
  
  <p><a href="https://ffmpeg.org/faq.html#Concatenating-using-the-concat-filter" rel="nofollow noreferrer">This ffmpeg documentation</a> presents three concatenation methods: filter, demuxer, and protocol. I think I want the "filter" flavor. However, <a href="https://trac.ffmpeg.org/wiki/Concatenate#filter" rel="nofollow noreferrer">their example</a> of it is confusing.</p>
  
Tags: <ffmpeg>
Title: ffmpeg: Concatenate then encode
UserDisplayName: ConvexMartian
ThreadText: # ffmpeg: Concatenate then encode
  
  (Asked by: username_0 on 2017-01-08)
  
  I have several similarly-encoded `.ts` video files that I would like to concatenate and encode into a single `.mp4` file.
  
  The `.ts` files look like
  
  ```
  Input #0, mpegts, from 'input1.ts':
    Duration: 00:01:24.14, start: 0.066778, bitrate: 15941 kb/s
    Program 1 
      Stream #0:0[0x44]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
      Stream #0:1[0x45]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 251 kb/s
  
  ```
  
  The output should be 640x480, 29.97fps video. (The `.ts` files contain digitized old [Hi8](https://en.wikipedia.org/wiki/8_mm_video_format#Hi8) camcorder video, digitized at a much-too-generous bitrate & resolution for the Hi8 video format.)
  
  I can encode a single `.ts` file like this:
  
  ```
  $ ffmpeg -i input1.ts -c:v libx264 -vf scale=640:480 -aspect 4:3 -preset slow -crf 22 -r 29.97 output.mp4
  
  ```
  
  **What is the correct way to concatenate several `.ts` files into a single `.mp4` without creating a huge intermediate `.ts` file?**
  
  [This ffmpeg documentation](https://ffmpeg.org/faq.html#Concatenating-using-the-concat-filter) presents three concatenation methods: filter, demuxer, and protocol. I think I want the "filter" flavor. However, [their example](https://trac.ffmpeg.org/wiki/Concatenate#filter) of it is confusing.
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-08. Score: 1 | Accepted answer
  
  You can just use the protocol
  
  ```
  ffmpeg -i "concat:in1.ts|in2.ts|in3.ts" -c:v libx264 -r 30000/1001 -vf scale=640:480 -aspect 4:3 -preset slow -crf 22 output.mp4
  
  ```
  
  
  ---
  
  