Presenter's Notes for "Video Editing on Linux - Part 1" [Title] I think most of you know me, but I'll do a quick introduction for those of you who may not. My name is Ben Rousch, and by day I get paid to be the IT department for Van Dam Iron Works, a small steel stair and railing company on the southwest side of Grand Rapids. By night, I am the father of a two year old boy, which is why I got into video editing. Back in 2007 it was impossible to find a video editor that approached something like iMovie in ease of use, features, and stability. So for a year or two, I set aside my inner freetard and used a Macbook and iMovie just so I could get things done without ripping my hair out. However, I dipped my foot back into the Linux video editing waters every few months, and about a year ago things really turned around. We now have a plethora of usable editors to pick from; each one having a slightly differ ent interface and feature set. None of them are quite as polished as iMovie, but they're certainly good enough for home movies. My goal in this series is to expose you to the things I've learned while playing with video editing on Linux. I'll help you avoid some pitfalls, save some time, and give you some of my indispensible tricks. In Part 1 I'll give you some introduction to multimedia files and codecs, how you can get video footage, and a few very useful commands for formatting and converting video on the command line. You'll come out of Part 2 well-equiped to start editing video on your own using the current best of breed non-linear video editor on Linux. In Part 3 I'll demo a few of the more advanced editing features such as transitions, effects, custom title screens, and subtitles. Enough jibber-jabber, let's get this thing going. [Video Resolutions] First I'll cover a few of the basic terms so we're on common ground. When you watch a movie or TV, it all seems pretty simple, but there's a heck of a lot going on behind the scenes. We'll start with video resolutions. A pixel is one dot on your video display. Your typical netbook has a screen probably 1024 pixels wide and 600 pixels tall. Your typical 20" LCD monitor is probably 1600x1280 pixels. And a High Def TV has either 1280x720 (720p) or 1920x1080 (1080p) pixels. Video used to be constrained by what everyone's old TV or VGA monitor would display, but the new stuff tends to be all high def. A lot of older devices like dumb phones and el cheapo webcams can't even shoot in 480p, let alone HD. Your video camera and your display device (monitor, TV, etc) probably won't have the same resultion. Even if yours do, most other people's won't. You also get things in standard or widescreen ratios. All of these funky sizes and ratios can be very confusing. In general, the more pixels your video has, the better it's going to look. But there's no point in dealing with a 1080p video if you're going to watch it on your Blackberry. [Multimedia Containers] Now that you're head is full of pixels and ratios, we'll go on to the really confusing stuff: multimedia files and codecs. A multimedia file, commonly called a video file, is really made up of three or more pieces. The container file is what you usually see on your hard disk. It's a file named something like pianocat.mp4 or lolz.avi. You double-click it to watch the video. That file is actually just a thin wrapper around just about any combination of video and audio files. It also contains metadata about the audio and video files stored within it and things like subtitles. Some of the containers are open standards, and others are proprietary. Some of them can contain only audio or video formatted in specific ways, others can handle just about any format. [Video Codecs] The video codec specifies how all of the pixels and movement and speed of a video is stored. I'm not going to go into the specific because quite frankly the math behind them is beyond my ken. In general, the simpler a codec is, the larger the resulting video file is going to be, and the fewer CPU resources it will require to be displayed. There are many, many video codecs - way too many to mention here. These are the ones you're most likely to come across. {Demo: ffmpeg -formats} At one end of the spectrum we have DV, which is a simple codec, and it runs about 200MB per minute of footage. That adds up fast. It also takes very little computing power to play a DV video. At the other end of the spectrum we have H264. This is a very complicated codec, but it produces much smaller files. It also takes a lot of resources to play a H264 video. [Audio Codecs] The audio codec specifies how the sound is stored in your multimedia container. There are not as many different audio codecs as there are video, and you're likely to only come across these few examples. [Ben's Target Formats] So with all of these containers and video codecs and audio codecs to pick from, which ones should you use? After extensive experimentation across Linux, Windows, and OSX, these are the containers and codecs that I have found work the best. They're listed from simplest/biggest file to most resource-instense/smallest file. If you're targeting a specific system, you might want to use something else, but I've found these formats will play on most systems without a lot of headache. If you need to play your video on something really old or low-powered, use MPEG2. This is the video codec used in DVD, so pretty much anything can play it. If you want to edit a video but don't have a super-awesome computer, use MPEG4. This codec works really well with every video editor I've tried. For uploading to YouTube, where file size for uploads is an issue, use H264. A lot of video editors have trouble using H264 directly due to resource usage, so I usually work in MPEG4 and reencode to H264 for distribution. So how do we get our multimedia files to Ben's Target Formats? That's where FFMPEG comes in. [FFMPEG] From the web site: "FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library. " It's used on Windows, OSX, and Linux in many video conversion utilities. In fact a lot of the online video conversion utilities are just a web frontend to ffmpeg. What do I use it for? I use it to quickly convert video and audio files from their current format to the format I want. I use it convert a resource-intensive hidh-def H264 video to something that can play on my kid's ancient 430x272 video player. I use it to convert files from Microsoft and Apple formats to ones that will work well with my video editor. I use it to convert a video to a series of jpegs so I can grab just one frame. I use it to strip the audio out of a video for use as an mp3. [FFMPEG Examples - Part 1] These are the commands I use to convert pretty much any video file to one of my target formats. [FFMPEG Examples - Part 2] The first command will turn each frame of a video into a jpeg. Make sure you create a directory to store them in, because this will make a lot of files. Cinelerra was very picky about slight problems with containers, so I used the second command to rebuild a container before editing a video with Cinelerra. [FFMPEG Examples - Part 3] The first command is the easiest way to see what video and audio codecs are stored in a file. When I used Blender's video editor, it was very touchy about the container's framerate matching the video's framerate. For some reason the container's framerate is frequeently different from the video's. I used the second command to fix the container's framerate. [FFMPEG Examples - Part 4] I use the first command to shring pretty much any video to the size and format that's best for my son's video player. Although I haven't used it, the second command should resize a video for playing on the Motorola Droid. [More Useful Tips - Part 1] Ubuntu comes loaded with most of the free codecs you will need, but you have to install proprietary codecs yourself. I recommend you add the Medibuntu repositories to your system and then install the following packages. This should give you most of the codecs you are likely to encounter. [More Useful Tips - Part 2] If you run into problems playing a video on Windows, OSX, or Linux, VLC is your best bet. Windows is especially annoying about videos, so I recommend you send along a copy of VLC if you give anyone using a Windows a video file. Handbrake is a nice cross-platform GUI program for ripping DVDs to media files. It gives you fine control over the quality and size of the generated video. It can be kind of a pain to download videos off of YouTube or other video sites. I use the Video downloadHelper Firefox plugin to make it easier. [Credits and License] These notes were originally created by Ben Rousch (brousch@gmail.com) and were presented at the 24 June 2010 West Michigan Linux Users Group meeting. The notes and its associated slideshow are released under the following license: Creative Commons Attribution 3 Unported http://creativecommons.org/licenses/by/3.0/