Answers.Body: <p><em>Step 4 (first attempt)</em> will work if you re-encode the 2nd video like the first (without the filters).</p>
  
  <p>What's happening is that besides the timescale difference between CC's output and ffmpeg's (which will only result in timing errors), x264 is producing a High profile stream with a different parameter set than CC's encoder. Re-encode the 2nd video with ffmpeg and your files should be matching. Alternatively, you can speed up in CC and export the 1st video.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T18:21:12.143Z
Answers.Text: Wow, this simple idea somehow eluded me. Thanks. Even though I strongly prefer to avoid re-encoding whenever possible, I might be willing in this scenario since I haven't found a better solution. P.S. In my experience, FFmpeg does a better job than Adobe Premiere Pro CC 2017 at speeding up a video while preserving audio pitch. Premiere's sounded pretty bad, surprisingly.
Answers.UserDisplayName: Ryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T18:23:56.877Z
Answers.Text: Export the audio separately and filter+encode+mux it with CC speeded video. No need to re-encode video then.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T18:11:40.943Z
Answers.LastActivityDate: 2018-07-27T18:11:40.943Z
Answers.UserDisplayName: Gyan
Answers.Body: <p>This seemed to work (roughly*):</p>
  
  <pre><code>ffmpeg -i video1_faster.mp4 -i video2.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a]  concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -c:v libx264 -x264-params "nal-hrd=cbr" -b:v 2.5M -minrate 2.5M -maxrate 2.5M -bufsize 5M final.mp4
  </code></pre>
  
  <p>Notice how I'd been missing the <code>-c:v libx264 -x264-params "nal-hrd=cbr"</code> part in "Step 4 (second attempt)" in my question above.</p>
  
  <p>*It decreased the bitrate of the audio to 103kbps even though the audio bitrates of the 2 input files were 317kbps and 127kbps. So my next project will be to try to figure out how to improve Step 2 to preserve the audio bitrate of the original file and then improve Step 4 to preserve the audio bitrates again.</p>
  
  <p>I'd definitely prefer to accept someone else's (better) answer.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T18:42:11.827Z
Answers.Text: I wouldn't pay much attention to Wistia's or most other site's bitrate guidelines. They are issued for a mass audience and are meant to be safe floors since most consumer and even pro video editors don't have encoders that do VBR well. Not the case for x264/5 and ffmpeg/fdk AAC. If it looks and sounds good, you're fine.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T19:04:09.240Z
Answers.Text: @Gyan That's probably generally true. In this case, it wasn't a guideline to the public but from an email discussion between me and the Wistia support team since my video wasn't performing well on different devices, and their instruction was to re-upload the video at at least 2500kbps.
Answers.UserDisplayName: Ryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T18:35:23.727Z
Answers.LastActivityDate: 2018-07-27T18:35:23.727Z
Answers.UserDisplayName: Ryan
Body: <p>I've already read the other articles about concatenating but couldn't find any that discuss specifying the output bitrate.</p>
  
  <p>I have 2 MP4 videos. </p>
  
  <p><strong>What I want to do is speed up the first video to 110% speed (without changing audio pitch) and then concatenate it with the second video (which will remain at normal speed), and I want the resulting video to have a bitrate of 2.5 Mbps</strong> (since that's what Wistia told me should be the minimum for my upload).</p>
  
  <p>Currently, my first attempt results in a video where the 2nd part is all mangled and shows bright green, etc. My second attempt (of Step 4) results in a video that has a total bitrate of only 1645kbps.</p>
  
  <p><strong>Step 1:</strong></p>
  
  <p>In Adobe Premiere Pro CC 2017, I've exported 2 videos, each using these settings:</p>
  
  <pre><code>Frame Rate: 30
  Field Order: Progressive
  Aspect: Square Pixels (1.0)
  Profile: Main
  Bitrate Encoding: CBR
  Target Bitrate [Mbps]: 2.5
  Audio Format: AAC
  Audio Codec: AAC
  Sample Rate: 48000 Hz
  Bitrate [kbps]: 320
  </code></pre>
  
  <p><strong>Step 2.</strong></p>
  
  <pre><code>ffmpeg -i video1.mp4 -filter_complex "setpts=PTS/1.1;atempo=1.1" -c:v libx264 -x264-params "nal-hrd=cbr" -b:v 2.5M -minrate 2.5M -maxrate 2.5M -bufsize 5M video1_faster.mp4
  </code></pre>
  
  <p><strong>Step 3.</strong>
  Create a text file of this content:</p>
  
  <pre><code>file 'video1_faster.mp4'
  file 'video2.mp4'
  </code></pre>
  
  <p><strong>Step 4 (first attempt).</strong></p>
  
  <pre><code>ffmpeg -f concat -safe 0 -i ffmpeg_concat_list.txt -c copy final.mp4
  </code></pre>
  
  <p><strong>Step 4 (second attempt) (with re-encoding).</strong></p>
  
  <pre><code>ffmpeg -i video1_faster.mp4 -i video2.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -b:v 2.5M -minrate 2.5M -maxrate 2.5M -bufsize 5M final.mp4
  </code></pre>
  
  <p>What am I doing wrong? Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-07T14:18:42.953Z
Comments.Text: The two files separate are OK?  What version of ffmpeg?
Comments.UserDisplayName: rogerdpack
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-07T15:44:41.810Z
Comments.Text: @rogerdpack Yes. `version N-82889-g54931fd Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.0 (GCC)`
Comments.UserDisplayName: Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-07T16:28:04.407Z
Comments.Text: couple years old, git master "may" work better who knows...
Comments.UserDisplayName: rogerdpack
Tags: <ffmpeg><premiere><transcoding><bitrate>
Title: How to concatenate 2 MP4 videos to output of certain bitrate?
UserDisplayName: Ryan
ThreadText: # How to concatenate 2 MP4 videos to output of certain bitrate?
  
  (Asked by: username_0 on 2018-07-27)
  
  I've already read the other articles about concatenating but couldn't find any that discuss specifying the output bitrate.
  
  I have 2 MP4 videos.
  
  **What I want to do is speed up the first video to 110% speed (without changing audio pitch) and then concatenate it with the second video (which will remain at normal speed), and I want the resulting video to have a bitrate of 2.5 Mbps** (since that's what Wistia told me should be the minimum for my upload).
  
  Currently, my first attempt results in a video where the 2nd part is all mangled and shows bright green, etc. My second attempt (of Step 4) results in a video that has a total bitrate of only 1645kbps.
  
  **Step 1:**
  
  In Adobe Premiere Pro CC 2017, I've exported 2 videos, each using these settings:
  
  ```
  Frame Rate: 30
  Field Order: Progressive
  Aspect: Square Pixels (1.0)
  Profile: Main
  Bitrate Encoding: CBR
  Target Bitrate [Mbps]: 2.5
  Audio Format: AAC
  Audio Codec: AAC
  Sample Rate: 48000 Hz
  Bitrate [kbps]: 320
  
  ```
  
  **Step 2.**
  
  ```
  ffmpeg -i video1.mp4 -filter_complex "setpts=PTS/1.1;atempo=1.1" -c:v libx264 -x264-params "nal-hrd=cbr" -b:v 2.5M -minrate 2.5M -maxrate 2.5M -bufsize 5M video1_faster.mp4
  
  ```
  
  **Step 3.**
  Create a text file of this content:
  
  ```
  file 'video1_faster.mp4'
  file 'video2.mp4'
  
  ```
  
  **Step 4 (first attempt).**
  
  ```
  ffmpeg -f concat -safe 0 -i ffmpeg_concat_list.txt -c copy final.mp4
  
  ```
  
  **Step 4 (second attempt) (with re-encoding).**
  
  ```
  ffmpeg -i video1_faster.mp4 -i video2.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -b:v 2.5M -minrate 2.5M -maxrate 2.5M -bufsize 5M final.mp4
  
  ```
  
  What am I doing wrong? Thanks.
  
  **Tags:** ffmpeg, premiere, transcoding, bitrate
  
  > **Comments:**
  > **username_1**: The two files separate are OK?  What version of ffmpeg?  
  > **username_0**: @username_1 Yes. `version N-82889-g54931fd Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.0 (GCC)`  
  > **username_1**: couple years old, git master "may" work better who knows...  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-07-27. Score: 2
  
  *Step 4 (first attempt)* will work if you re-encode the 2nd video like the first (without the filters).
  
  What's happening is that besides the timescale difference between CC's output and ffmpeg's (which will only result in timing errors), x264 is producing a High profile stream with a different parameter set than CC's encoder. Re-encode the 2nd video with ffmpeg and your files should be matching. Alternatively, you can speed up in CC and export the 1st video.
  
  > **Comments:**
  > **username_0**: Wow, this simple idea somehow eluded me. Thanks. Even though I strongly prefer to avoid re-encoding whenever possible, I might be willing in this scenario since I haven't found a better solution. P.S. In my experience, FFmpeg does a better job than Adobe Premiere Pro CC 2017 at speeding up a video while preserving audio pitch. Premiere's sounded pretty bad, surprisingly.  
  > **username_2**: Export the audio separately and filter+encode+mux it with CC speeded video. No need to re-encode video then.  
  
  ---
  
  ### Answer by username_0 on 2018-07-27. Score: 0
  
  This seemed to work (roughly\*):
  
  ```
  ffmpeg -i video1_faster.mp4 -i video2.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a]  concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -c:v libx264 -x264-params "nal-hrd=cbr" -b:v 2.5M -minrate 2.5M -maxrate 2.5M -bufsize 5M final.mp4
  
  ```
  
  Notice how I'd been missing the `-c:v libx264 -x264-params "nal-hrd=cbr"` part in "Step 4 (second attempt)" in my question above.
  
  \*It decreased the bitrate of the audio to 103kbps even though the audio bitrates of the 2 input files were 317kbps and 127kbps. So my next project will be to try to figure out how to improve Step 2 to preserve the audio bitrate of the original file and then improve Step 4 to preserve the audio bitrates again.
  
  I'd definitely prefer to accept someone else's (better) answer.
  
  > **Comments:**
  > **username_2**: I wouldn't pay much attention to Wistia's or most other site's bitrate guidelines. They are issued for a mass audience and are meant to be safe floors since most consumer and even pro video editors don't have encoders that do VBR well. Not the case for x264/5 and ffmpeg/fdk AAC. If it looks and sounds good, you're fine.  
  > **username_0**: @username_2 That's probably generally true. In this case, it wasn't a guideline to the public but from an email discussion between me and the Wistia support team since my video wasn't performing well on different devices, and their instruction was to re-upload the video at at least 2500kbps.  
  
  ---
  
  