Select Page

Often for me one of 2 scenarios arise. The first is I’ve used my portable HD video recorder to make a video, and now I need to chop it up into smaller pieces. Not necessarily edit the video, just chop it into smaller pieces. Like when my band “Not Even” plays the bar and we tape 30 – 60 minutes of the show. Then when I get home, I need to chop that video up into segments of each song we can use on YouTube and the website.

Another scenario I ran into recently was I ripped a DVD into a single file, and was going to put that on our 120GB portalble USB hard drive. Turns out the thing is formatted in FAT32 and won’t accept files <4GB. So, I needed to chop that file into 2 files in order to get the movie on there. The great thing about Linux is that you have the command line. You don't necessarily need a GUI point and click software program to get light utility work like this done. Your Linux computer most likely has the 2 most powerful image and video editing tools already installed: ffmpeg and mplayer. Normally processing video takes a bit of a toll on your memory and processor. If say you're rippig a DVD (HD quality) and then you want to convert that to AVI Xvid, or H264 Apple format - it could take quite awhile to convert that frame by frame from one format and quality into another. On the other hand - just copying a segment of a video into a smaller file of it's own - is very quick, simple, and easy. All you have to do is open a command line box and navigate to where your video is stored on your computer. In this example we're chopping up a 2:10:00 video (2 hours and 10 minutes) in 2 smaller videos. Run the ffmpeg command like this: this example will create the first video. It will copy the first hour of the larger video into a smaller file containing just the first hour. myvideo.mpg is the name of the file we're copying from, and 0:00:00 is the starting point, and 1:00:00 is the stopping point, and myvideosegment1.mpg is the name of the output file. ffmpeg -y -i myvideo.mpg -ss 0:00:00 -t 1:00:00 -vcodec copy -acodec copy myvideosegment1.mpg Our larger video is 2 hours 10 minutes long, so in this example we're going to copy the last part of the video from the 1 hr point until the end into a new file called myvideosegment2.mpg. ffmpeg -y -i myvideo.mpg -ss 1:00:00 -t 2:10:00 -vcodec copy -acodec copy myvideosegment2.mpg There you have it! In just minutes we've copied the first and last half of a big video into 2 smaller videos (without affecting the orignal file at all). You can do all kinds of video tricks with ffmpeg. convert ogv to avi: mencoder -idx -ovc lavc -oac mp3lame -o output.avi convert mpeg to flv: ffmpeg -i -deinterlace -ar 44100 -r 25 -qmin 3 -qmax 6 convert mpg to avi: ffmpeg -i test.mpg -sameq test.avi convert avi to mp4: ffmpeg -i test.avi -b 1000k -async 1 output.mp4 convert flv to mp4: ffmpeg -i test.flv -b 600k test.mp4 For a few more tricks, check out some of these handy ffmpeg commands.