Body: <p>I am trying to add two videos using ffmpeg and the output video/audio is out of sync (and fast forwarded). </p>
  
  <p>Goal is to put <code>intro.mp4</code>  before the original file <code>clip.flv</code></p>
  
  <p>My approach is to</p>
  
  <ol>
  <li><p>Change the format of <code>clip.flv</code> to <code>clip.mp4</code> </p></li>
  <li><p>Concat <code>intro.mp4</code> with <code>clip.mp4</code></p></li>
  </ol>
  
  <p>I get a video where intro plays well and then when clip starts it's audio is not in sync with video also the video seems to be fast forwarded with sound seems to be high pitch</p>
  
  <p>I have used both <code>handbrake</code> and <code>ffmpeg</code> for conversion and concatenating.</p>
  
  <hr>
  
  <h2>Files Metadata</h2>
  
  <h3>Original source file <code>clip.flv</code> metadata</h3>
  
  <pre><code>Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 1500 kb/s, **30 fps**, 30 tbr, **1k tbn**, 60 tbc
  Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 160 kb/s
  </code></pre>
  
  <h3>Intermediary file <code>intro.mp4</code> metadata</h3>
  
  <pre><code>Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 130 kb/s, **30 fps**, 30 tbr, **30k tbn**, 60k tbc (default)
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s 
  </code></pre>
  
  <h3>File <code>clip.mp4</code> metadata</h3>
  
  <pre><code>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 1500 kb/s, 30 fps, 30 tbr, 16k tbn, 60 tbc (default)
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 160 kb/s (default)
  </code></pre>
  
  <hr>
  
  <p>Things I have tried</p>
  
  <ul>
  <li>As you'll see that the both videos have same frame rate but <strong>different timescale</strong>, I have tried changing the timescale of one of the video to match the other before combining the video but with no luck.</li>
  <li><em>Update:</em> I tried a workaround to convert the video to intermediary format <code>.MTS</code>, then concat the videos and then convert output video to <code>.mp4</code> as final output. Initially that seems to work but on performing more operations(trim and concat again) on the output video reveals that the video has unspecified pixal format and won't let me do those operations further</li>
  </ul>
  
  <p><strong>If you need more info to help, please ask. It's quite important for me to solve this.</strong></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-04T23:11:49.783Z
Comments.Text: Welcome! Please be aware, it is considered poor etiquette to ask the same question on more than one SE site at the same time.
Comments.UserDisplayName: Michael Liebman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-05T02:44:21.180Z
Comments.Text: Thanks Michael for sharing. I shared it to get different perspective. Programming level perspective on SO. Production level perspective(how other video producers do this) here. Which is why I did not include the code here. Not a good approach?
Comments.UserDisplayName: invider
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-05T20:08:34.897Z
Comments.Text: You are correct that isn't the encouraged approach. You can get high quality help with all aspects of FFmpeg here, but only if you share the information in the SO question and then some (full logs, Mediainfo debug output, sample files, etc.). SE questions are encouraged to stand on their own and not need links to external resources so that the question and answer remain useful over time.
Comments.UserDisplayName: Michael Liebman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-06T02:46:01.007Z
Comments.Text: Understood, some more questions
  1. For long list of debug output, should I include an external file ?
  2. I haven't received any response here, what should I do?
Comments.UserDisplayName: invider
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-06T02:53:09.090Z
Comments.Text: About your suggestion to keep question only at one place, I don't have enough reputation here, so I would like to first see if there is any response here, if so, I will keep it here and remove SO question. Otherwise I will remove this one put up bounty on SO (I have some reputation to spend on there). 7 hrs to go.
Comments.UserDisplayName: invider
Tags: <ffmpeg><encoding><transcoding><sync><formats>
Title: Post-production editing audio/video out of sync
UserDisplayName: invider
ThreadText: # Post-production editing audio/video out of sync
  
  (Asked by: username_0 on 2020-06-04)
  
  I am trying to add two videos using ffmpeg and the output video/audio is out of sync (and fast forwarded).
  
  Goal is to put `intro.mp4` before the original file `clip.flv`
  
  My approach is to
  
  1. Change the format of `clip.flv` to `clip.mp4`
  2. Concat `intro.mp4` with `clip.mp4`
  
  I get a video where intro plays well and then when clip starts it's audio is not in sync with video also the video seems to be fast forwarded with sound seems to be high pitch
  
  I have used both `handbrake` and `ffmpeg` for conversion and concatenating.
  
  ---
  
  ## Files Metadata
  
  ### Original source file `clip.flv` metadata
  
  ```
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 1500 kb/s, **30 fps**, 30 tbr, **1k tbn**, 60 tbc
  Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 160 kb/s
  
  ```
  
  ### Intermediary file `intro.mp4` metadata
  
  ```
  Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 130 kb/s, **30 fps**, 30 tbr, **30k tbn**, 60k tbc (default)
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s 
  
  ```
  
  ### File `clip.mp4` metadata
  
  ```
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 1500 kb/s, 30 fps, 30 tbr, 16k tbn, 60 tbc (default)
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 160 kb/s (default)
  
  ```
  
  ---
  
  Things I have tried
  
  * As you'll see that the both videos have same frame rate but **different timescale**, I have tried changing the timescale of one of the video to match the other before combining the video but with no luck.
  * *Update:* I tried a workaround to convert the video to intermediary format `.MTS`, then concat the videos and then convert output video to `.mp4` as final output. Initially that seems to work but on performing more operations(trim and concat again) on the output video reveals that the video has unspecified pixal format and won't let me do those operations further
  
  **If you need more info to help, please ask. It's quite important for me to solve this.**
  
  **Tags:** ffmpeg, encoding, transcoding, sync, formats
  
  > **Comments:**
  > **username_1**: Welcome! Please be aware, it is considered poor etiquette to ask the same question on more than one SE site at the same time.  
  > **username_0**: Thanks username_1 for sharing. I shared it to get different perspective. Programming level perspective on SO. Production level perspective(how other video producers do this) here. Which is why I did not include the code here. Not a good approach?  
  > **username_1**: You are correct that isn't the encouraged approach. You can get high quality help with all aspects of FFmpeg here, but only if you share the information in the SO question and then some (full logs, Mediainfo debug output, sample files, etc.). SE questions are encouraged to stand on their own and not need links to external resources so that the question and answer remain useful over time.  
  > **username_0**: Understood, some more questions 1. For long list of debug output, should I include an external file ? 2. I haven't received any response here, what should I do?  
  > **username_0**: About your suggestion to keep question only at one place, I don't have enough reputation here, so I would like to first see if there is any response here, if so, I will keep it here and remove SO question. Otherwise I will remove this one put up bounty on SO (I have some reputation to spend on there). 7 hrs to go.  
  
  ---
  
  ## 0 answers
  
  