Cut and Stitch Clips with ffmpeg
For quick and dirty editing of audio and video in the terminal, ffmpeg can do the job.
DaVinci isn't around, or you don't want to leave the lovely ascii of the terminal. Go find ffmpeg.
Cutting Clips with ffmpeg
ffmpeg can copy or transcode video. If you give it a start and/or stop timestamp, it can do clips or subsections of the video.
ffmpeg -i input.webm -ss 00:42:41 -to 00:42:44 output.mp4
-ss
is the starting sample-to
is the end of the clip
Timestamps can be in hh:mm:ss format or in seconds.
Stitching Together Clips with ffmpeg
ffmpeg can combine videos into a single video. There are apparently several methods for this. The one I've used successfully is reliable but very wordy:
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4
-i
marks the input. Use multiple of these.-filter_complex
is... complex. I don't get it all. In essence, you're describing your inputs and outputs. We're going to take all the video and audio inputs and output audio and videon=2
- we have 2 inputs, son
is 2. Adjust to number of inputs.-map
designates input streams that are used in output, here both video and audio
There's probably a better or easier method for this. Do any of ya'll know of one? Please let me know.