Video Codecs and the Free World
Whether you are encoding video you have produced and want to distribute or are taking video from one source and transcoding it into a format more friendly to your system, there are handy open-source encoders that generate video files playable by many popular consumer content players. The most effective is the FFmpeg program—sometimes wrapped in a GUI and sometimes used strictly on the command line. The FFmpeg man page is extensive but fairly easily to use.
Video encoding is best learned by doing, and although there are many important variables when encoding video, there are no magic settings; they change in relation to the target size of the video as well as the actual content (for example, how frequently pixels change chroma or luma values from one video frame to another).
To encode a video, first make sure you have FFmpeg installed on your system. If not, add it via the command line (sudo apt-get install ffmpeg on Debian systems), or use your distribution's package manager.
The command to encode looks like this:
ffmpeg -i [filename] -vcodec [codec to use] -s [target frame size] ↪-b [target bit rate in kbps] -r [target frames per second] ↪-acodec [audio codec to use] -pass 2 -ar [target audio sample rate] ↪-ab [audio bit rate in kbps] -f [target file format] [output filename]
ffmpeg -i bigmovie.m4v -vcodec xvid -s 720x480 -b 3000k -r 24 ↪-acodec libfaac -pass 2 -ar 128k -f .mp4 freemovie.mp4
The example above transcodes a video from a proprietary MPEG-4 format into the open-source codec of Xvid with libfaac sound, in a standard definition frame size and a fairly high video quality.
The important variables are frame size (-s), as it determines scalability of the video, and bit rate (-b for video and -ar for audio), which determines how much information is being sent per video frame—the higher the bit rate, the sharper and nicer the image will be but also the file size will be larger. Finally, the -pass variable determines how much preprocessing the encoder will do to the video. In one-pass mode, the encoding is done fairly quickly and not always optimally. With two-pass encoding, FFmpeg reviews the video file once, gathers necessary data, and then does the actual encoding on the second pass. The end result is a higher quality compression, but you can expect double or triple the encoding time.
The other popular way of transcoding video is with GUI programs that rip video from encoded DVDs, making them viewable in an unrestricted codec. This also is ideal for creating a home media server, with your entire movie collection digitized and ready to play at any moment. Obviously, the legality of this varies from day to day and from country to country. However, the GUI programs are plentiful and utilize the same variables as FFmpeg. You will need to set the video codec to which you want to save your video, the audio codec, the bit rates of each, frame size and so on.
The great codecs of the Free Software movement, Ogg Vorbis and Ogg Theora, are obviously very well supported on GNU/Linux. Generating them is done easily with ffmpeg2theora. The command-line variables for ffmpeg2theora are similar to those for FFmpeg:
ffmpeg2theora [filename] -x [target horizontal pixel count] ↪-y [target vertical pixel count] -V [target bi trate in kbps] ↪-A [audio bit rate] -c [audio channels] -H [audio sample rate] ↪-o [output filename]
When it became clear to the Open Source movement that video codecs were doomed to remain proprietary and counter-productive, the Ogg format was born. Open to all and freely available to any system, Ogg Vorbis (for sound) and Ogg Theora (for video) are advanced and fully featured codecs.
A common argument against using Ogg is that it requires users of Microsoft and Apple products (or, the majority of computer users) to seek out a suitable player. Yet, it's clear by now that requiring users to download a media player or media plugin is not at all uncommon and will quite probably become even more common as content delivery becomes more Internet-reliant and computer-centric. People today expect to have to download a video player to watch certain video content. The real problem with Ogg is that there is no ubiquitous media player for the format; RealPlayer has Real Media, QuickTime has QuickTime Player, Windows Media has Windows Media Player, Flash has Flash Player and so on. People easily can find those, but where do they go for Ogg playback?
Promote both free software and free codecs by promoting Ogg formats, but don't fail to promote a player that easily and effectively plays media on all major platforms. One of the better players for this job is VLC player, which installs on Windows, Mac OS X, GNU/Linux, BSD, BeOS and Solaris. Another is miro, an iTunes-like aggregator of video podcasts, IP TV and YouTube, as well as media on your local machine. Both play Ogg, so send a link to the player along with the Ogg clips you distribute.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- Google's SwiftShader Released
- SUSE LLC's SUSE Manager
- My +1 Sword of Productivity
- Interview with Patrick Volkerding
- Managing Linux Using Puppet
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Non-Linux FOSS: Caffeine!
- SuperTuxKart 0.9.2 Released
- Tech Tip: Really Simple HTTP Server with Python
- Parsing an RSS News Feed with a Bash Script
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide