Video and audio extraction and conversion, Linux style

Linux is quite superb if you need to download, rip, encode, decode, convert, extract or store audio and video files. If you are not afraid of command line, you have many totally free tools at your disposal. Most important and useful of these are

DownloadHelper and UnPlug(Firefox addon)
mplayer
ffmpeg
vlc
K3b
K9copy
dvd::rip
Acidrip
DVDAuthor
soundKonverter
SOX
split and cat
avidemux
mencoder
KdenLive
OGMRip
MKVToolnix

If you are using some Ubuntu-variant, handling different codecs etc. is quite easy. You do not have hunt through obscure web pages to find them. Just use apt-get and install them.

First check that you have all normal repositories (main, resctricted, universe, multiverse) activated. Then add following repositories either by editing /etc/apt/sources-list or using synaptic GUI.


deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner
deb http://packages.medibuntu.org/ lucid free non-free
deb-src http://packages.medibuntu.org/ lucid free non-free
deb http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

Then add medibuntu repository key and then update


wget --quiet http://packages.medibuntu.org/medibuntu-key.gpg -O - | sudo apt-key add -
sudo apt-get update

Now you are ready to go. You can install all necessary software with following command. Notice, that I use mixture of KDE and Gnome applications on Xubuntu.


sudo apt-get install vlc mplayer vlc vlc-plugin-pulse ffmpeg winff dvdauthor sox soundkonverter lame libdvdcss2 w32codecs k3b libk3b6-extracodecs kdenlive avidemux mjpegtools ubuntu-restricted-extras kubuntu-restricted-extras k9copy dvdrip rar

If you happen to use 64bit system, then substitute w32codecs with w64codecs.

General guidelines in Video ripping
What parameters, options, codecs and file format you use is matter of personal taste and depends also on intended use, especially platform. If you want to rip a dvd, and watch it on some small portable device, you should not use same options as ripping high-quality video for large full-HD screen. Higher the quality, larger the file. High-quality full-HD video decoding needs processing power, too. On low spec machine you may be watching slideshow, since machine cannot decode it fast enough. On the other hand, if your rip is too low quality, there is no point watching it on big screen. It will look just awful.

Large screen, powerful machine.
I recommend avi-file with 2-pass filtering, XviD encoding, MP3 audio, and file size should be approximatelly 1.4 Gb for 1h 30m movie. This should ensure reasonable resolution. If your system is very powerful, then MKV container (or mp4), H264 video, AAC audio. Nice feature in MKV (Matroska) is that you may have several audio tracks embedded (e.g. 2 different languages + comments).

Portable device
Filetype depends on what device you will use to watch the video. Some handsets understand only certain formats and codecs, so check your manual. If you can play a video file perfectly on your laptop does not mean that it will play on your smartphone or some other pocket size device. You have to check these things

  • Maximum resolution. Most pocket size devices have maximum resolution like 800×400 or even less. Try to match that resolution as closely as possible, so that there is no need to scale the image. There may also be individual restrictions for certain codecs.
  • Containers. Most will play avi. Other possibilities are flv (Flash video), mp4, mkv (Matroska), Ogg, RM (RealMedia), 3GP, ASF, Quicktime and several others. Check the manual
  • Video codecs. Xvid, DivX, H.264, H.263, mpeg-4, WMV
  • Audio codecs. mp2, mp3, Vorbis, FLAC, WMA
  • Video and audio codec combinations. Even if your machine can play some audio files encoded with certain codec does not necessarily mean, that video player understands.
  • Subtitles. Does the player support subtitles, and in what format (srt, vobsub). If it does not support subtitles, they have to be hard-coded in video itself.

As you can see, it is not just a question “can my machine play avi-files or Matroska-files”. First, it has to understand the container format. Some containers may hold different types of compressed and uncompressed video and audio data, in different resolutions and aspect ratios. It has to meet all requirements, otherwise it will not play at all, or it might play without audio or video.

Even then, you should remember, that portable devices are not that powerful compared to desktop machines. If the resolution of video is too big, picture might be jerky or machine will not play it at all. So, use smaller resolutions, but I would still use 2-pass filtering. Best way is to experiment. Take some small video (e.g. 5 minutes with moderately fast movement). Rip and encrypt it first in high or normal quality. Repeat this process and diminish the quality each time (smaller resolution, different codecs). And then test all these versions to find out the optimal quality.

Leave a comment

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 105 other subscribers