Quickly Trim Video Snippets on the Command Line with FFmpeg

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello internet in this video we are going to be taking a look at this really nice tool that i found for streamers or content creators like myself who need to edit a video really quickly um typically you do this by importing it into a video editor but a lot of those video editors are going to re-encode your video and this means that there's a bunch of time in both re-encoding it uh so you have to actually render the video and that takes a long time plus it just takes a lot of time to get all that stuff set up so a lot of times say you have a stream and you want to cut out your intro or something you don't necessarily want to to do all that work it's just easier to just upload the whole thing um this tool ffmpeg allows you to more quickly edit things because it allows you to edit a copy of a file without re-encoding it this means that at least for me uh doing this is about 50 times faster it changes per video and i think that's pretty normal it also depends on what i'm doing on this computer because this is my main workstation so i'm working on it most of the time not just encoding videos um but it provides a much easier way to do it and it's something that you can run if you're ver if you're familiar with the command line this is something that you can use to more quickly access this um so if you you have that kind of background uh this is a tool that might be useful especially if you just need those really quick edits because it's something you can do in one line um so that's what we're going to be doing here um i have a video here that we're just going to grab and hopefully pull out the end of um so in all my videos i have like a 10 minute a 10 second outro we're going to just extract that so we're just going to pull that bit out we'll probably do something else as well just to kind of demonstrate this but ffmpeg is way more powerful than i am going to show in this video it's just a really powerful tool there's a ton of things you can do with it one of them is editing things like this um that if you want to explore it go ahead uh i do not understand or know half of the things it can do so we're gonna gonna start from there uh if you don't have it you need to install it ffmpeg supports mac linux and windows i installed it with chocolaty on windows it should be on app and a few other things as well so if you use brew on mac or apt on debian or i i forget um you can you can do that so ffmpeg has all these things that you can provide it and this is all confusing you don't really need to know any of this but these are all the the parameters this is command line stuff uh if you're already confused uh this might not be the tool for you i think there is a gui based version of this but then you're kind of getting back into that video editor thing i it's kind of a balance um for me i use this for like really quick things if i just need to cut out a set amount of time at the start or something like that um the way this works is we give it f mpeg and then give it an input so let's get back to the top and just do ffmpeg and give it an input so dash i is going to define an input file in this case it's our ballistic penetration video um so this is the video that i did it's about 30 minutes long and about two gigs two gigs one gig two gigs uh so it's about a two gig video file in 4k uh and we are going to re-cut this effectively um so we are going to start at some specific uh point um so dash ss is when to start the new clip um there's also a dash two which is when to end whatever it is um so in this case let's actually cut out the first five minutes um so hours minutes and seconds we can just encode it like that and then let's also cut off the final bits um so this is going to be final bits of our video so i actually need to open this so you might hear two of me uh but we're gonna actually run this hello internet today i wanted to take a look and then jump to the end and so right around oh that's not that's not useful at all that doesn't tell me a time at all 27 55 we'll say um so if we jump to 27.55 that will be our end uh we'll still get some of it because i didn't do this very exact um you can make it more exact i i did this quick because it's a demonstration we don't need to get this exact i don't actually need this for anything um this is all going away and then the important part to do is provide a codec codecs are sort of how the video is encoded so mp4 is a codec it defines all sorts of how everything's going to be rendered and stored you can provide a special keyword for this called copy what that says is do not re-encode this it's effectively saying take the source material and reuse it reuse it in the new copy that you're going to create so that's what we're telling it to do here this is going to prevent it from re-encoding if you remove this it is going to take significantly longer so don't do that however one of the nice things for ffmpeg one of the things that you can do is say grab a clip from your video and export it as a gif or gif or however you prefer to pronounce it or as some other video format so let's say you need to change from mp4 to flv uh it can support that as well so you you can you can transcode things to whatever video format you need if whatever platform you're you're trying to get to only takes specific formats um so those are options as well but anyway we're going to copy it and then we're going to send it to our copy.mpe4 this is just going to export whatever it is to our copy.mp4 uh this will take a bit uh it it should go pretty fast though uh the video it should be about we did five minutes and then to 27 so it should be about 22 minutes uh and we are already 10 minutes through the video um so this goes relatively quickly it's not instant like you're not it's not going to immediately complete but if you ever rendered a video um this is not a quick process ever um this is the fastest that i've found to do this um and for like stream things which are typically hours long uh if you if you're trying to do that in a high resolution like 4k um i'm sorry it's just going to take forever um typically the lower resolution is going to be a bit faster and smaller file sizes and all that but we're already done we've already rendered a 22 minute video and it's ready for us to play so here we go it's full half a gig smaller uh and here's here's the video [Music] yeah so so wherever we are we're somewhere in the middle of that um and that is the start of it and then we have we would have cut off the end as well i'm not going to go too much into that you can play around with this yourself the tool is relatively easy to get again it should support any of the normal package managers you probably aren't going to find this in an app store um but i haven't really looked uh it's pretty widely used and pretty well maintained so it should be available out there and there's pretty good documentation as well on the website um so if you want to do this or you want to use it for something else there are a whole bunch of other applications for this tool not just this simple case that i showed um but for me one of the things that i've noticed the most is streamers again where you have a stream starting in five minutes thing uh and then the stream starts in five minutes uh if you're trying to upload that to youtube you can just cut out that first five minutes without having to pull it into premiere or sony vegas or whatever whatever your your software is is it sony vegas i don't i don't use it um but anyway you don't have to do that you can just do this um so if this is your thing then there you go uh i will leave it here because that's pretty much everything i wanted to cover hopefully it's simple enough um i've also probably put something on my website that covers this in text so if that's your preferred way you can go and check that out as well there will be a link in the description but that's it for now i will leave it here and hopefully this is helpful and you can use it in whatever video you're trying to edit uh so yeah i will see you in the next video so until then see internet you
Info
Channel: World of Zero
Views: 4,518
Rating: undefined out of 5
Keywords: world of zero, lets make, ffmpeg, ffmpeg -c copy, quick tip, tip, example, tutorial, quickly edit video, edit video, video edit, video editor, cli video editor, cli, shell, command line, edit video ffmpeg, using ffmpeg, edit stream, fast edit video, edit video fast, tool, tools, ffmpeg example, walkthrough, terminal video editor, command line video editor, -c copy, edit out stream start, edit out start screen, transcode, encode, use ffmpeg, open source, open source video editor, sh
Id: Cg2omJAOH30
Channel Id: undefined
Length: 9min 0sec (540 seconds)
Published: Thu Mar 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.