0

I want to concatenate two files having the following outputs from ffmpeg :

file1:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
  Duration: 00:00:02.01, start: 0.000000, bitrate: 172 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 158 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, 2 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

file2:

Input #0, matroska,webm, from 'file2.mkv':
  Metadata:
    ENCODER         : Lavf58.20.100
  Duration: 00:01:13.10, start: 0.000000, bitrate: 418 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      DURATION        : 00:01:13.100000000
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : simple_aac_recording
      DURATION        : 00:01:13.002000000

In order to concatenate them, I use the following command:

ffmpeg -f concat -safe 0 -i concat.txt -c copy output.mp4

The concatenation is done but the process outputs many times:

Non-monotonous DTS in output stream 0:1; previous: 99677, current: 76011; changing to 99678. This may result in incorrect timestamps in the output file.

When watching the output file, the video output from the first file is OK, but the rendering of the second part (file2) is considerably accelerated. Regarding the audio, there is only a small part of file2 during the video coming out of file1.

ffmpeg output from the concatenation file :

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:05.94, start: 0.000000, bitrate: 5210 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2787 kb/s, 377.45 fps, 50 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 6750 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

file1 has no audio, so I do not need its audio output. I can encode file1 differently, but I would rather keep file2 as it is.

1 Answer 1

0

I am not sure to have the solution, but since nobody else answered (I should comment instead of answering, but my score is not high enough for that)...

I encountered once a similar issue, and I could solve it by using the MKV format instead of the MP4 format for the input files. So try converting file1.mp4 to file1.mkv with ffmpeg -i file1.mp4 -c copy file1.mkv, and then concatenating the two MKV files.

(BTW the title is incorrect: the problem is not "different bitrates" but "different framerates")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .