Hot on HuffPost Tech:

See More Stories
Free Switched iPhone app - try it now!
AOL Tech

Flipping the Linux switch: ZOMG! ffmpeg!

Small SoundConverter screen shot.The plain truth is I don't like working with media files. Watching them, or listening to them, sure, I'm just as into that as the next girl. When it comes to actually converting them from something captured off an external device or my screen, though, my stomach turns. It's not an aversion that's peculiar to Linux. I hate using the Windows for those same tasks. Since I don't have access to a Mac, I can't vouch for the ease of media conversion on them, but I can safely say that as ubiquitous as Quicktime is, I have very little luck working with (or viewing) Quicktime files on any machine with any operating system in my possession.

Linux presents special challenges with media file conversions. The good news is that though some of the tools might be a little tricky to decipher, they do a great job with conversions and tend to encompass a wide range of file types. Some tools can be used with GUI front-ends, and some I've found are just a lot faster and easier to bang out a command in a terminal window. Many of these tools are either installed by default in a number of Linux distributions, or can be added with a few clicks through the distro's repositories.

So I admit it was with a whole lot of fear and loathing that I decided to include screencasts in a recent post on KDE. My video grab software was working wonderfully, but it saved my files as .ogv. That wouldn't be a problem if I weren't hosting it elsewhere, and if the conversion software on that site didn't require it be in a format other than .ogv. And Ogg files, being funny beasts, aren't always the easiest things to convert.

And certainly, they aren't the only things you'd want to convert in Linux. So let's shake down how it's done.
If you've used Linux for a while, you've probably come to realize that most of the graphical point and click interface you see is really just a command line and accompanying switches and arguments with a pretty face. There's no exception with conversions, either... except that you may even find that the command line is more versatile than some GUIs, and ultimately easier and faster to use.

Most media conversion GUIs handle one, or several, encoders and decoders. There are multiple command line encoders and decoders, as well, but there are a few that you'll find you'll use more than others. At some point or another, every Linux user deals with lame on some level, even though they might not realize it. Others might find themselves dealing with the hard to pronounce but ever so useful ffmpeg.

Because I am totally at peace with easy-if-effective, and because many people start converting music before video files, I would recommend starting your conversion experience with SoundConverter (GNOME) or the similarly named (with comparable functions) KDE application, SoundKonverter.

GNOME's SoundConverter relies on gstreamer for handling the files in question. KDE's SoundKonverter relies on having individual codecs/encoders installed for certain functions or file types (like lame for mp3, or flac for lossless audio conversion). Both desktop's GUI conversion tools and supporting codecs/encoders/decoders should be commonly available in repositories.

Shown here is GNOME's SoundConverter. It's really straightforward.

I'm gonna convert Greg's song out of this impossibly stoopid format with SoundConverter

Simply add your file (or a whole folder's worth) to the application, and click convert. It's helpful to note that I'm converting here from .m4a... but to what? Ah, yes, what application is complete without a visit to the Preferences dialog where I click check boxes and buttons till my heart's content?

SoundConverter Preference Dialog

Again, pretty self-explanatory sort of dialog box, and it essentially runs the commands for you painlessly. Depending on conversion file type chosen, there are a few different options available (for instance, converting to MP3 allows for fiddling around with bitrates, in at least a very general manner).

Certainly these are not the only GUI tools for sound file conversion. Many media players for Linux, for instance, will automatically import your audio CDs into a specified format if you wish. I am enamored of the tools I've mentioned, though, because conversion is their main focus, and they're relatively fast and flexible.

Video has the tendency to be a little more hair raising to work with. Maybe it's because more media elements converge in a video file -- sure, those moving pictures are nice, but most people will incorporate some sort of sound. Of course, it's all presented as a package deal, and the files have this annoying tendency to be large and cumbersome to work with.

Video also comes from a wider range of sources. Video screen captures don't necessarily require editing or the production quality that home videos do. Presentations may require more production quality.

There are a number of video editing applications out there for Linux. Each offers something a little different -- Kino edits video that's been pulled from a camcorder in a fairly straightforward manner, Jahshaka creates video with a true multimedia aspect, using animation and still frames, Cinerella offers that motion picture feel -- but whichever works for you, all have a conversion tool that takes your project from the cutting room floor to the viewable project end point.

This is where I find things get frustrating. These in-program conversions work reasonably well. They do what they are designed to do. Except, of course, if you find, as I did, that your program only outputs in .ogv (or another format), and YouTube or Vimeo doesn't recognize that format to do the conversion to Flash.

You might also find that some of these programs are a bit cryptic in allowing you to set the picture quality you really desire for your end product. It's probably not that Linux is unable to deliver the desired result, but it might be that the software in question wasn't able to (or didn't see a real need for) including an option for every last switch and argument your conversion tool understands.

Here is where I recommend something that might make a newbie nervous, but worry not (just keep a couple copies of your original file, if things are that fear inducing). Converting video via the command line (in a terminal window) is generally much faster than with a GUI, and allows for much more customization of how you really want your output to look.

For instance, many conversion applications (even on the command line) aim for quality/size ratio by default. Not a bad thing if I wanted to upload a short video to YouTube where high quality isn't a huge issue. But with the KDE video captures, for instance, I found I had a problem using a generic conversion from the .ogv files. The originals were clear and pretty. Converting to an mpeg file that Vimeo, our uploading/hosting service could use turned those files into blurry, pixellated masses of yechh.

This is why using a command line tool like ffmpeg in a terminal is handy. First, my botched conversions were fast. No more time wasted than necessary finding out that it wasn't going to work for me in that manner. Second, I could issue this command at my prompt:

ffmpeg -h | less


man ffmpeg (This doesn't always work, as some distros don't install ffmpeg's man page with ffmpeg, but the -h command displays the same content, and there is always Google for quick reference.)

The output of the help file/man page can be overwhelming. Relax. Those extra options and switches are not all necessary. I am not at all experienced with video editing (which ffmpeg can do via command line as well) and many of those options deal with adjusting video and audio in ways I can't fathom. The command that got my video quality where it needed to be after the conversion:

ffmpeg -sameq -i originalfile.ogv convertedfile.mpeg

Breakdown of this command: I called ffmpeg, and gave the -sameq switch, which tells ffmpeg to aim for the same video quality as the source file. It does, for the most part. There is a bit of (inevitable) degradation, but it's not objectionable. I also used the -i switch to let ffmpeg know that my input file was to follow. My input file's (-i) name and extension were given, and then I told ffmpeg where I wanted it converted to, and into what format (hint: ffmpeg -formats issued on the command line gives a long list of available encoding and decoding formats).

Bottom line? Fear not media conversions in Linux. Though there are a number of encoders and decoders, most have a wide range of abilities, and you'll find you have a list of your own "usual conversion suspect" tools soon. Graphical tools can be useful for certain file types, but if they're not giving the desired results, check out your conversion command's man page, or help file. A few extra minutes reading to get the desired (and impressive!) results can go a long way to making your multimedia files shine.

Tags: conversion, ffmpeg, file conversion, FileConversion, gstreamer, lame, linux, linux-switch, media, media converters, MediaConverters, opensource, video, video capture, VideoCapture