How to combine videos together with ffmpeg

Поділитися
Вставка
  • Опубліковано 27 сер 2024
  • 🎨 Artist: / bonecloset | / bonecloset
    🎥 My Gear: kit.co/dfeury
    🎓 Mentoring: forms.gle/SVrD...
    We cover three ways to concatenate (join) multiple video files together. The first is the demuxer method, the second is using file level concatenation, and lastly using a complex filtergraph.
    WANT TO SUPPORT THE CHANNEL? ###
    💰 Patreon: / donaldfeury
    💳 Paypal: www.paypal.me/...
    🛍️ Amazon: amzn.to/3pCNgzJ
    💸 Crypto: cointr.ee/dona...
    SOCIAL PLATFORMS ###
    🎦 Twitch: / dfeury
    🗨️ Discord: / discord
    🐦 Twitter: / feurydonald
    VIDEO PLATFORMS ###
    📽️ LBRY: lbry.tv/$/invi...
    🎥 Odysee: odysee.com/$/i...
    OTHER THINGS ###
    📁 GitLab: gitlab.com/dak425
    SOFTWARE I USE ###
    🌐 Brave Browser - brave.com/
    🎞 ffmpeg: ffmpeg.org/
    📽️ Open Broadcaster Software: obsproject.com/
    🎨 GIMP: www.gimp.org/
    📙 Neovim: neovim.io/
    🗒️ Doom Emacs: github.com/hli...
    Thank ya'll for your time and support!
    #ffmpeg #concatvideos #videoediting

КОМЕНТАРІ • 51

  • @DonaldFeury
    @DonaldFeury  4 роки тому +12

    Timestamps for the different methods:
    01:29 - concat demuxer method
    05:31 - file level concatenation method
    09:45 - concat filter using a complex filtergraph

  • @liaison-music
    @liaison-music 6 місяців тому +1

    This is cool. Am looking to experiment with concatenating with ffmpeg and spare the graphics card from rendering an identical repetitive vid section several times. Thank for the candid walkthrough. 2 seconds to process. ...Gold.

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

    Man! Thanks for this vid 🔥🔥

  • @dinesh2474
    @dinesh2474 3 роки тому +5

    One of the best FFmpeg Videos I have seen on UA-cam :) Way to go man! Thanks

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

    Subscribed because of the vibe. You don't move fast.

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

      I have recorded some videos with Ubuntu ScreenRecorder and some with my Galaxy smartphone. They're all in mp4. The problem is that when I concatenate them into a single one, the ones recorded with my phone flip with 90 degrees. And a part of the video remains blank. I converted whole to ts before merging into mp4. Any suggestions?

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

    Hi Donald, great set of videos, but I guess I was looking for how to cross fade between two clips. How about adding a video on that too?

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

      I'll see when I can get around to it but the filter you're looking for is called "xfade": trac.ffmpeg.org/wiki/Xfade

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

    thx for the tips about " at file level concat with .ts transport stream" .i was trying to concat obs files with my gh5 camera files.....tried a gazillions things but none of them worked.
    after converting to .ts the video files worked seemlesly!!!!!
    i made a couple off drag and drop scripts and viola super fast editing/pasting without rendering!!!!!

  • @alexmarchese4048
    @alexmarchese4048 3 роки тому +1

    Thank you for the great video!
    I have thousands of mp4 videos to concatenate (they have all the same properties).
    Therefore I am running the cmd command from the first approach in a programmatic way through a Python script (I am using subprocess.run(cmd_command, shell=True, cwd=path)).
    It does not work though. Even if I am passing in cmd_command the exact same command as when I do it manually from the cmd, from Python it does not work. I believe it is an issue of ffmpeg as I am getting the message "Invalid data found when processing input".
    What would you recommend doing? Does it work for you?

    • @alexmarchese4048
      @alexmarchese4048 3 роки тому +1

      I am answering myself haha.
      I realized that the mistake was beacuse of the .txt file that, being also created automatically, often remained empty (I did a mistake in the code for it).
      So I can fully confirm that this great first approach shown in the video fully works also when the command is called from a Python script (i.e. with the subprocess library in my case)

    • @DonaldFeury
      @DonaldFeury  3 роки тому +1

      Good job finding that out

  • @dmitriyfishman4023
    @dmitriyfishman4023 3 роки тому +1

    Cool, keep going!

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

    halo bro. can help me... how to merge 2 video top bottom with ffmpeg in scale 9/16?

  • @roykorthouwer389
    @roykorthouwer389 3 роки тому +1

    Hey man quick question i have like 2000 mp4 videos which all need the same mp4 outro ( they got the same fps height and with) , I've different approaches but none of them gives me the desired result got any ideas ?

    • @DonaldFeury
      @DonaldFeury  3 роки тому

      Maybe have a bash script that loops over every file and performs a ffmpeg command to concat the outro, and writes the new version to a seperate directory.

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

    Hi Donald, thank you for this tutorial! I'm having some issues... When I try to concat 2 or more videos (from the same source clip, so similar encoding) there's a brief pause between them at the joining point. I've been trying to tweak things around to no avail. Have you encountered this issue or have you heard of this before? Btw I'm running on Windows 10 but I'll probably give it a shot on Linux.

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

    Hey quick question, how could i save the merged file to another seperate folder?

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

      The output can be a path anywhere in your file system. So you could do something like "~/merged/output.mp4" to save it in a folder called merged in your home folder

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

      @@DonaldFeury oh right that simple 🙈. Thank you so much - keep up the great work! 👏

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

      @@calvinjsamuel all good, thank you very much!

  • @707jeevan
    @707jeevan Рік тому

    How to make the third code dynamic rather than a fixed number of videos

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

    Thanks bro, your Videos are very useful!
    Iam desperately searching for a way to put together two videos, like one on the left side and one on the right, like a split screen.
    Do you have any idea how I can realize that?
    Thank you so much

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

      You can do that ffmpeg.org/ffmpeg-filters.html#hstack-1
      I can't remember exactly what I show but I did a video on that exact subject a long time ago.
      ua-cam.com/video/659dOQPwfdQ/v-deo.html

  • @muzeasd
    @muzeasd 3 роки тому +2

    Thanks man. Great video indeed. Love from Pakistan. But I got a problem. One video had display resolution of 1280x720 and other video had display resolution of 640x288. Ffmpeg gave following error
    Input link in1:v0 parameters (size 288x640, SAR 0:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 1:1)
    How do I configure sizes, for input or output, when using complex filter? Thanks again :)

    • @DonaldFeury
      @DonaldFeury  3 роки тому +1

      You'll probably need to scale the resolution of one video to the same resolution as the other, look at ffmpeg.org/ffmpeg-filters.html#scale-1

    • @muzeasd
      @muzeasd 3 роки тому

      @@DonaldFeury Yes. IMHO I think, instead of comparing two videos' resolutions, it would be better to scale both videos to an acceptable resolution (say 640x480). But I can not seem to find the right syntax for that in complex filter. Can you help in that please?

    • @DonaldFeury
      @DonaldFeury  3 роки тому

      @@muzeasd The link i shared before should still work for you but you would need to use scale on both video inputs to make sure they are the same resolution before concatenating them

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

    Hi. Somewhere in your video appears a nice trick similar to ffmpeg -hide_banner -i "concat:$F1|$F2|$F3" -c copy $Fres (F1, F2, F3, Fres properly defined). I observe that with three files (same origin, same encoding) the result is shortened to 5'52" if longer. Can you guess why?

  • @notthatfalconcoin538
    @notthatfalconcoin538 3 роки тому +1

    hey bud can you do a video or a blog on how to use multiple .txt files like it says in the wiki? "Changing playlist files on the fly"
    so at the end of the file on 1st list.txt you reference to the next playlist?

    • @DonaldFeury
      @DonaldFeury  3 роки тому

      I haven't personally had to do this as I haven't had the need but if I ever need to I certainly will

  • @george0511
    @george0511 3 роки тому

    How would I combine a .ogg with a .h264 to a MP4?

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

    liked and subbed thanks for this video! i'm trying to join to video files in android. All the editors increase the size of output file drastically so I'm going to fix that in my editor

  • @user-lc1ph5jg5k
    @user-lc1ph5jg5k 4 роки тому

    i had a lot of problems using ffmpeg to concat files. so i decide to use mencoder to concat

    • @DonaldFeury
      @DonaldFeury  4 роки тому

      The only time I've ran into issues was when I was trying to concat without re-encoding.

  • @Crisis.Knight
    @Crisis.Knight 3 роки тому

    When I make the txt, and the the coincat command, its says " Unsafe file name" and I can't do more.

    • @DonaldFeury
      @DonaldFeury  3 роки тому +1

      Oh right I forgot sometimes thats an issue, if you're sure your file paths are correct you can add "-safe 0" before the "-i" flag where you're passing in your txt file

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

    anyone able to pull off cutting videos into clips while doing complex filter graph method at once? (aka concat vid 1 from t0-tn with vid 2 from t0-tn)

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

      i was able to get it, but i am now trying to add audio (hopefully multiple clips)- ex. vid1 plays from 0-4, vid 2 plays from 4-10, audio 1 plays from 2-6, audio 2 plays from 6-9
      here is what i have so far that is not working, and i am guessing it is b/c i am not truly "concat-ing" the audio stream, rather i want to overlay the audio of result (which i can do fine with a two step process, but wondering if it is possible to get done in 1 command):
      ffmpeg -ss 00:00:02 -t 2 -i test1.mp4 -ss 00:00:00 -t 5 -i test2.mp4 -ss 0:00:00 -t 4 -i audiotest.wav -filter_complex '[0:v][1:v][2:a] concat=n=3:v=1:a=1 [outv] [outa]' -map '[outv]' -map '[outa]’ result.mp4

  • @goldenwallnut4284
    @goldenwallnut4284 3 роки тому

    when i use demux concat my files freeze at around 30 seconds and only play audio

    • @DonaldFeury
      @DonaldFeury  3 роки тому +1

      Sometimes there can be issues if the files you are doing the concat with have different encodings or properties (resolution, framerate, etc). If you keep having issues doing the demux approach, do the concat filter approach.

    • @goldenwallnut4284
      @goldenwallnut4284 3 роки тому

      @@DonaldFeury ty dude love your videos keep them up, I figured out it was a problem with the ffmpeg version :)

    • @DonaldFeury
      @DonaldFeury  3 роки тому

      @@goldenwallnut4284 Oh nice, glad you figured it out

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

    this is so bad. They should just make a intuitive ui all these commands are absurd and trash.

    • @DonaldFeury
      @DonaldFeury  11 місяців тому

      You're looking for a video editor like Davinci Resolve.