Body: <p>I am trying to concatenate up to 4 (appx.  800MB) mp4/mkv videos at a time, losslessly, and preferably with little or no re-encoding.  All have similar,  but not identical, properties. The issue I am having is when I am able to concate any files, the audio of the latter videos becomes gradually more and more out of sync.</p>
  
  <p>It seems I am having a fps and/or timestamp asyncronicity, but I am unsure.  I've been able to looslessly remux from mp4 with differing resolutions- to ts files,  then concate the ts files successfully into a new mp4, alas the audio sync issue. </p>
  
  <p>I am relitively new to the concate scene and am limited to ONLY an android device,  therefor I am limited to FFmpeg CLI, and the FFmpeg media encoder apps for android.  All signs point to needing mkvmerge at the very least,  but I cannot find a comparable app for Android. </p>
  
  <p>Can anyone suggest a solution exclusively for android?  And can anyone please explain how the fps and timestamp function/relate/can be modified,  in layman terms? I keep reading command switches (TBN, PTS,  etc...)  that I don't understand,  not to mention the syntax switches used to manipulate them.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-29T04:54:59.440Z
Comments.Text: This happens when some of the files have no audio or audio shorter than the video.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T07:22:50.497Z
Comments.Text: The problem exists with even only two, which both definitely have audio from start to finish:
Comments.UserDisplayName: Harleycarr81
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T07:25:54.580Z
Comments.Text: Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.2.103
    Duration: 01:39:34.04, start: 0.000000, bitrate: 1140 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 801:800 DAR 12:5], 1049 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 83 kb/s (default)
      Metadata:
Comments.UserDisplayName: Harleycarr81
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T07:29:35.417Z
Comments.Text: Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.9.100
    Duration: 01:48:04.04, start: 0.000000, bitrate: 1175 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 801:800 DAR 12:5], 1049 kb/s, 23.98 fps, 23.98 tbr, 27021 tbn, 47.95 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
Comments.UserDisplayName: Harleycarr81
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T07:32:01.687Z
Comments.Text: Same resolution,  different fps, tbn?,  and tbc? This is just one example of my conundrum. Any thoughts on how to proceed?
Comments.UserDisplayName: Harleycarr81
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T07:51:37.200Z
Comments.Text: If it is merely a difference in lengths obetween audio and video,  how's would I go about matching them appropriately, without re-encoding? (Android friendly only)
Comments.UserDisplayName: Harleycarr81
Tags: <ffmpeg>
Title: Problem with audio sync when concatenating multiple mp4(s)
UserDisplayName: Harleycarr81
ThreadText: # Problem with audio sync when concatenating multiple mp4(s)
  
  (Asked by: username_0 on 2019-04-28)
  
  I am trying to concatenate up to 4 (appx. 800MB) mp4/mkv videos at a time, losslessly, and preferably with little or no re-encoding. All have similar, but not identical, properties. The issue I am having is when I am able to concate any files, the audio of the latter videos becomes gradually more and more out of sync.
  
  It seems I am having a fps and/or timestamp asyncronicity, but I am unsure. I've been able to looslessly remux from mp4 with differing resolutions- to ts files, then concate the ts files successfully into a new mp4, alas the audio sync issue.
  
  I am relitively new to the concate scene and am limited to ONLY an android device, therefor I am limited to FFmpeg CLI, and the FFmpeg media encoder apps for android. All signs point to needing mkvmerge at the very least, but I cannot find a comparable app for Android.
  
  Can anyone suggest a solution exclusively for android? And can anyone please explain how the fps and timestamp function/relate/can be modified, in layman terms? I keep reading command switches (TBN, PTS, etc...) that I don't understand, not to mention the syntax switches used to manipulate them.
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: This happens when some of the files have no audio or audio shorter than the video.  
  > **username_0**: The problem exists with even only two, which both definitely have audio from start to finish:  
  > **username_0**: Metadata:     major_brand     : isom     minor_version   : 512     compatible_brands: isomiso2avc1mp41     encoder         : Lavf58.2.103   Duration: 01:39:34.04, start: 0.000000, bitrate: 1140 kb/s     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 801:800 DAR 12:5], 1049 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)     Metadata:       handler_name    : VideoHandler     Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 83 kb/s (default)     Metadata:  
  > **username_0**: Metadata:     major_brand     : isom     minor_version   : 512     compatible_brands: isomiso2avc1mp41     encoder         : Lavf58.9.100   Duration: 01:48:04.04, start: 0.000000, bitrate: 1175 kb/s     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 801:800 DAR 12:5], 1049 kb/s, 23.98 fps, 23.98 tbr, 27021 tbn, 47.95 tbc (default)     Metadata:       handler_name    : VideoHandler     Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)  
  > **username_0**: Same resolution,  different fps, tbn?,  and tbc? This is just one example of my conundrum. Any thoughts on how to proceed?  
  > **username_0**: If it is merely a difference in lengths obetween audio and video,  how's would I go about matching them appropriately, without re-encoding? (Android friendly only)  
  
  ---
  
  ## 0 answers
  
  