-2

I processing two videos as follows:

ffmpeg -i video-raw/455848793538790988_duration18.051.mp4 -b:v 993k -b:a 128k -vf "scale=720x1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1:1" video-proc/455848793538790988_duration18.051.mp4

and

ffmpeg -i video-raw/14425661295137552_duration11.666.mp4  -b:v 993k -b:a 128k -vf "scale=720x1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1:1" video-proc/14425661295137552_duration11.666.mp4

then running the following command to concat:

ffmpeg -f concat -safe 0 -i video-concat/dogs-2021-04-17-06-46-id-1.txt -c:v copy -c:a copy ./output.mp4

the resulting video starts properly but when getting to the second video the image stuck and and sound becomes slow.

The ffprobe results are as follow:

Before processing:

ffprobe video-raw/14425661295137552_duration11.666.mp4 

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video-raw/14425661295137552_duration11.666.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:11.68, start: 0.000000, bitrate: 565 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x800 [SAR 1:1 DAR 4:5], 462 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 93 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

for the second one:

ffprobe video-raw/455848793538790988_duration18.051.mp4

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video-raw/455848793538790988_duration18.051.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:18.07, start: 0.000000, bitrate: 655 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt709/bt709), 576x1024 [SAR 1:1 DAR 9:16], 585 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 62 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

after processing:

ffprobe video-proc/14425661295137552_duration11.666.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video-proc/14425661295137552_duration11.666.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:11.70, start: 0.000000, bitrate: 1133 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], 993 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 130 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

and the second one

ffprobe video-proc/455848793538790988_duration18.051.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video-proc/455848793538790988_duration18.051.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:18.19, start: 0.000000, bitrate: 1044 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], 923 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 112 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

any ideas whats wrong? both videos play perfect separately after processing but not after the concat

Stas Ezersky
  • 343
  • 2
  • 10
  • Because you're already pre-processing each input consider using the concat filter. Then you can do it all in one command. For examples see [How to concatenate videos in ffmpeg with different attributes?](https://stackoverflow.com/a/57367243/) – llogan Apr 19 '21 at 17:18

1 Answers1

0

Eventually the community on Reddit answered this here

The problem was that the FPS of both my inputs wasn't identical even after the processing commands - so I added "-r 30" for both processing commands to force FPS of 30 and the concat worked like magic

Stas Ezersky
  • 343
  • 2
  • 10