How to concatenate two videos using FFmpeg?

Поділитися
Вставка
  • Опубліковано 5 жов 2024
  • In this video I explained with example how to concatinate or merge multiple videos into one video with avalable options like using existing encoding or re-encoding.
    Watch the full video and feel free to put your query / feedback about the video. More helpful contents are on the way
    ffmpeg concatenate videos,ffmpeg concatenate mp4,ffmpeg concatenate mov files,ffmpeg concatenate videos side by side,ffmpeg concatenate images to video,ffmpeg concatenate video files,ffmpeg concatenate avi,ffmpeg merge audio and video,ffmpeg concatenate different codecs,ffmpeg concatenate mp3,ffmpeg concatenate mkv,ffmpeg concatenate mp3 files,ffmpeg concatenate two videos,ffmpeg merge two videos,ffmpeg concatenate without re encoding,ffmpeg concatenate 2 videos

КОМЕНТАРІ • 30

  • @overcrumbled
    @overcrumbled 2 роки тому +2

    I've never used ffmpeg before, but this tutorial is brilliant. Nice and easy to follow compared to other videos that are unnecessarily complicated!

    • @mzmnbd
      @mzmnbd  2 роки тому

      thank you so much ♥️

  • @noskillnochill
    @noskillnochill Рік тому +1

    Thank you so much! great tutorial, exactly what I needed to know.

    • @mzmnbd
      @mzmnbd  Рік тому

      thank you so much for saying that

  • @MicheleAlbano
    @MicheleAlbano 3 місяці тому

    Hi, congratulations for the simplicity in describing the process of concatenating even different videos.
    A question...
    I have two 360° videos in mov format can I use the ffmpeg command or do I necessarily have to convert them to Mp4?
    There are converters that when they convert from mov to mp4 make the video no longer 360.
    thanks

    • @mzmnbd
      @mzmnbd  3 місяці тому +1

      Yes, you can

    • @MicheleAlbano
      @MicheleAlbano 3 місяці тому

      @@mzmnbd Can you write me the command line?

    • @mzmnbd
      @mzmnbd  3 місяці тому +1

      @@MicheleAlbano sorry about that. could you try using chat gpt?

  • @solveiteasy1795
    @solveiteasy1795 4 місяці тому

    I already follow ffmpeg -f concat -i drone-shots.txt -c copy output.mp4 but the result, sound of output video very slow, it not keep same with original sound.

    • @mzmnbd
      @mzmnbd  4 місяці тому

      i understand. can you check what is the codec and bitrate for audio in each file? if they are not same, then instead of copying codec, reencode the video, this should resolve the issue

  • @danielparga7154
    @danielparga7154 Рік тому +1

    Great video thank you!

    • @mzmnbd
      @mzmnbd  Рік тому

      Glad you liked it!

  • @RomanianProductions
    @RomanianProductions 6 місяців тому +1

    I get “non-monotonic dts” and even without -c the video doesn’t play correctly

    • @mzmnbd
      @mzmnbd  5 місяців тому +1

      Thanks for your comment! The 'non-monotonic dts' error can occur due to timestamp issues. Try adding '-fflags +genpts' before the input files in your ffmpeg command to fix it. Let me know if that helps!

  • @Ulibert
    @Ulibert Рік тому +1

    how about doing this on google drive video files and merge it please make tutorial using google colab on it

    • @mzmnbd
      @mzmnbd  Рік тому

      nice question, but I have no idea on this, let me know if you find anything.

  • @Sequoyas
    @Sequoyas Рік тому

    if i have 3 video files with the same codec, arguments, and extra arguments does it keep them in the output file

    • @mzmnbd
      @mzmnbd  Рік тому

      When concatenating multiple video files using FFmpeg, the codec, resolution, and other parameters of the input files must be consistent for the output file to be playable. If the input files all have the same codec and resolution, and you are using the same arguments and extra arguments for all the input files, then it is likely that the output file will be playable.
      To concatenate multiple video files using FFmpeg, you can use the concat filter. The basic syntax is as follows:
      ffmpeg -i file1.mp4 -i file2.mp4 -i file3.mp4 -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" output.mp4
      This command will take 3 video files file1.mp4, file2.mp4 and file3.mp4 and concatenate them in to a single output file output.mp4.
      In this command, n=3 specifies the number of input files to be concatenated, v=1 specifies that the video streams should be concatenated and a=1 specifies that the audio streams should be concatenated.
      It's important to note that, if the input video files have different codecs, resolutions, or other parameters, FFmpeg will not be able to concatenate them directly. You would have to re-encode the input files to match the codec, resolution, and other parameters of one of the input files.
      Also, when concatenating video files, it is important to ensure that the video and audio streams are correctly aligned so that the final output file is in sync.

  • @adarshranjan2935
    @adarshranjan2935 2 роки тому

    Dada, What's the meaning of " -f" in this command ffmpeg -f concat -i drone-shots.txt -c copy output.mp4???

    • @mzmnbd
      @mzmnbd  2 роки тому +1

      -f means flag, which is to concatenate in this scenario
      thanks for being a regular watcher of my videos

  • @jitendrachouhan7024
    @jitendrachouhan7024 2 роки тому +1

    How to use ffmpeg in server (cloud computing)

    • @mzmnbd
      @mzmnbd  2 роки тому +1

      you can wrap it with other programming language or just run the command with a server side programming language

  • @jagag7716
    @jagag7716 7 місяців тому

    but i got output too much length 26:57:29
    input file1 00:21:30
    input file2 00:03:20 how to solve this error

    • @mzmnbd
      @mzmnbd  5 місяців тому

      It seems like the output duration is longer than expected. This might happen due to incorrect input durations or incorrect concatenation settings. Make sure the durations of your input files are accurately specified in the ffmpeg command. You can also try explicitly setting the output duration using the '-t' option followed by the desired duration. Let me know if you need further clarification!

  • @ansorisaputra9751
    @ansorisaputra9751 9 місяців тому

    brother.. how remove bg music, but keep voice in video music? code ffmpeg plase?

    • @mzmnbd
      @mzmnbd  9 місяців тому

      use splitter. ai

    • @ansorisaputra9751
      @ansorisaputra9751 8 місяців тому

      if make code ffmpeg brother?@@mzmnbd

  • @spicysoda318
    @spicysoda318 Рік тому

    thx

    • @mzmnbd
      @mzmnbd  Рік тому

      you are welcome