Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > General > Linux, Mac OS X, & Co

Thread Tools Search this Thread Display Modes
Old 23rd March 2005, 04:35   #1  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Linux Audio/Video FAQ

Welcome to the Linux Audio/Video FAQ. The goal of this FAQ is to help *nix users, especially those migrating from windows, to accomplish AV tasks in a *nix environment. That being said, having good basic *nix skills will help you out with a lot of the tips mentioned in this FAQ. It will also be hard to get through this FAQ without basic AV knowledge (check out the 'basics' section under Guides on http://www.doom9.org ).

This FAQ is not intended to be a linux basics guide. In the introduction section we'll mention a few tips and some links that can get you started, but after that we'll assume you're fairly comfortable with using linux and have a working linux installation.

If you have any additional FAQ questions (with or without answers), please post them below or in the FAQ development thread and I'll merge them in. Like most linux documentation this FAQ is a community project with many contributors; please see the last post in this thread for credits and changelog.

Part 1 - Introduction to Linux

Part 2 - AV Playback under Linux

Part 3 - General AV Encoding in Linux

Part 4 - DVD Video (MPEG-2) Ripping & Transcoding

Part 5 - DV / Digital Camcorder Encoding

Part 6 - MPEG-4 Video Encoding

Part 7 - Advanced Container Formats

Part 8 - Audio Encoding

Part 9 - CD / DVD Burning

Part 10 - Installing wine & emulating windows programs

Part 11 - Credits & Changelog

Last edited by KpeX; 23rd March 2005 at 04:58.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:37   #2  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 1: Introduction to Linux

1. What is Linux? What is the minimum I need to know?

"Linux" generally refers to an open-source Unix-clone operating system based on the Linux kernel, written from scratch originally by Linus Torvalds and other smart people from across the web. Although the linux kernel, which interfaces with a computer's hardware, is the core of the operating system, many other programs are needed to form a complete operating system.

Various commercial and non-commercial groups produce Linux-based operating systems containing the kernel, all necessary programs, and an installer. These different versions of linux are referred to as distributions.

There are hundreds of distributions available, with hundreds of different target applications and philosophies on software. There is also much more information available about getting started with linux/unix than is within the scope of this AV faq. Some excellent places to get started learning about distributions are www.distrowatch.com , www.linuxquestions.org , and www.linuxiso.org .

2. I've heard that linux is a very technical operating system. Will it be too difficult for me?

With many of the modern user-friendly distributions, such as Mandrake or Fedora, a great deal of technical knowledge is not needed to install and use software. Good sites to find general guides and answer your questions:

http://www.linuxquestions.org (Great community forums, newbie-friendly)
http://www.tldp.org (extremely in-depth HOW-TOs and FAQs)

Whenever you hit a problem, you should first check any available documentation for the software involved and search the forums here and some of the sites mentioned above. Linux software in general is quite well documented, most programs include manuals or 'man-pages' which can be accessed as follows:
man commandname 
For Example
man mplayer displays the manpage for mplayer
Also take a look in /usr/doc/ for readmes and other included documentation.

Note: Keeping with common bash nomenclature, in all parts of this FAQ, a command preceded by a '$' prompt indicates that the command should be run from a terminal as a user, and a '#' prompt indicating the command should be run as root.

3. Can I keep windows on my computer and still use linux?

Virtually all modern linux distributions are windows-aware and will detect your windows partition and allow you to dual-boot your PC (meaning you will see a menu when you turn on your PC to choose linux or windows). Linux installers will install a 'bootloader' (a pre-OS software that allows you to boot different operating systems) as part of the installation process. You'll need to install windows first and then linux in order to dual-boot since windows' bootloader will overwrite the bootloader that allows you to dual-boot.

4. What about installing software under linux?

Although this FAQ is not meant to be a guide to using linux, much of the questions we discuss will require new software, so we will quickly reference the three major ways of installing software:
  • Package distribution: Virtually all linux distributions use some soft of package system, such as RPM (Redhat & many others), DEB (Debian), or TGZ (Slackware). A packaging system is meant to be an easy way of installing software, similar to windows installers. A package file consists of the compiled software and files required, and a script to tell the package managing software how and where to install the files. Most distributions have both command-line and GUI interfaces to their packaging system. Check the documentation for your distribution for how to install packaged software. To install from commandline for the most common package formats:
    rpm:  # rpm -i packagename.rpm (see 'man rpm' for more help)
    DEB (debian):  # apt-get install packagename (see 'man apt-get')
    Slackware TGZ:  # installpkg packagename.tgz (see 'man installpkg', 'man pkgtool')
    Gentoo (portage):  # emerge packagename (see 'man emerge')
  • Binary archives: Some software is distributed pre-compiled in binary packages, common extensions are .tar.gz or .tar.bz2. To install such software, simply extract the archive:

    tar xvjf name.tar.bz2 or
    tar xvzf name.tar.gz

    and move the contents of the archive to your desired location. If the software is required to be in a specific location, check the documentation for the software.
  • Source distributions: Much of the software we will be using for AV conversions is distributed in source form, in which you download the source code for a program and compile it yourself. To compile software, you will need to install the development software included with your distribution (such as gcc, g++, make, autoconf, libtool, etc. - different software requires different tools). Then simply untar the source archive in whatever directory you prefer to keep your source code (a common choice is /usr/local/src). Instructions for building the source code are included normally in the root of the archive in the INSTALL file, but the most common method of compiling is a three command method, executed from the root of the source directory:

    ./configure (checks for the required software and headers)
    make (builds and links the software)
    make install (copies the compiled software and libraries to the appropriate directory)

    If any of the steps failed, check the error message, it will usually tell you what is missing or what went wrong. To perform the final step, you will most likely need to be root (su command).
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:39   #3  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 2: AV Playback under Linux

1. Do I need to do any extra setup for audio / video output?

Since we already assumed you have an up and running linux installation, you most likely won't have to do any work in this area. Most modern distributions automatically configure X and audio for you, and there is a host of information on the web for configuring X.

As far as audio goes, there are many different audio architectures available. We recommend choosing a distribution that uses ALSA (the advanced linux sound architecture) by default since it is the most powerful sound system and supports the most hardware. If your distribution doesn't include it, check out Q19 of the AC3 FAQ or this gentoo ALSA guide.

2. What is a good audio/video player for linux?

There are many excellent AV players available for linux, the three most popular are mplayer, videolan's VLC, and xine. Binary packages of these players are included in most distributions.

Since mplayer is one of the most versastile players, includes mencoder, one of the best transcoding softwares, and is one of the easiest players to build from source, we'll mention how to install mplayer here:

1.) Install any applicable libraries/codecs you want to use with mplayer first. For basic operation you'll probably want libavcodec, xvid, and some win32 binary codecs (for formats without open source libraries). Download one of the binary codec packs from the mplayer homepage (for example extralite.tar.gz) and extract it to /usr/local/lib/codecs/. If you're compiling from CVS (recommended) make sure to check out the libavcodec source for copying into the mplayer source directory:
$ cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg/libavcodec
For more information on the involved software see http://mplayerhq.hu/DOCS/HTML/en/install.html and http://mplayerhq.hu/DOCS/HTML/en/codecs.html#ffmpeg .

2.) Download mplayer source code from http://www.mplayerhq.hu/homepage/design7/dload.html . The recommended version is always the latest CVS (mplayer-current.tar.bz2) Although binary packages from mplayer are available for many systems, it is usually better to compile from source since mplayer will be optimized for your processor, and the installation will detect what codec and AV output libraries are present on your system. Unpack the tarball in your directory of choice:
 $ tar xvjf mplayer-current.tar.bz2
Or if you want to use CVS for quicker future updates:
$ cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer co main
Don't forget to copy the libavcodec directory we checked out earlier into the 'main' directory.

3.) Configure mplayer by running ./configure from the root of the mplayer directory. './configure --help' will show you some configuration options, and you may want to add support for the GUI and for large files:
$ ./configure --enable-gui --enable-largefiles
After running this script will tell you which codecs and output libraries have been detected, check through the list to make sure everything you need has been detected. You can then build and install mplayer and mencoder:
$ make
# make install
4.) Be sure to read over the mplayer manpage ( I know it's enormous) to become familiar with its control. You can add options to the mplayer config file (default /usr/local/etc/mplayer/mplayer.conf) rather than specifying them on the commandline. My mplayer.conf looks like this: (specify dvd drive location, alsa audio driver, and try S/PDIF output before others)
In order to run the GUI you'll need to put a skin in '/usr/local/share/mplayer/Skin/default' (download & install a skin from the homepage, unpack, and rename the folder to 'default') and a default sub font in '~/.mplayer/subfont.ttf'.

Now you should be set to play with mplayer and encode with mencoder. You can find lots more information on all these topics in the mplayer documentation ( http://mplayerhq.hu/DOCS/HTML/en/ ) and the mplayer manpage ('man mplayer').

3. What about a good audio player for linux?

Two good winamp-like players for linux are XMMS and beep-media-player (a fork of XMMS with an updated interface). One or both of these is included with many distributions.

Like winamp there are a host of input and output plugins available for XMMS. You can get the source for these at the xmms homepage or from your distribution's repositories (in the case of gentoo, debian, or other distros with vast repositories).

A newer audio player that is gaining much popularity is amaroK. amaroK features a gstreamer interface, an advanced media library, highly configurable interface, cover art downloading plugin, and much more.

Please note that some distros such as Redhat/Fedora do not include an mp3 decoder with XMMS due to legal reasons. In this case you need to install an mp3 plugin, check out rpm.livna.org for RPMs of this and other packages omitted from the Fedora/Red Hat distribution.

4. What options do I have for playing DVDs under linux?

Many distributions include some sort of DVD capable player in their main repository. Please note that as with MP3, some distributions do not include CSS-decrypting capable players due to legal reasons. As above rpms can be found at rpm.livna.org, or you can install your own player.

A full mplayer install as noted above will be dvd-capable (although mplayer does not support menues at this time) and you can play dvds through the GUI or by the command
mplayer dvd://1 -dvd-device /dev/hdc
In this example the dvd device is /dev/hdc, you'll need to specify the device via CLI or config file unless the device is the mplayer default /dev/dvd.

Videolan's VLC is another good choice for dvd playback, you can find binaries on their homepage or source install instructions here.

Two other common DVD players are xine and ogle.

4B. How can I playback an ISO image of a DVD on my hard drive?

You can easily mount the iso and then play it back as if it is a mounted DVD disc, for example:
 # mkdir /mnt/dvd_image 
creates the mountpoint directory

# mount -o loop -t udf /path/to/image.iso /mnt/dvd_image 
mounts the ISO image /path/to/image.iso on the /mnt/dvd_image directory

$ mplayer dvd://1 -dvd-device /mnt/dvd_image 
Plays the mounted image with mplayer

$ vlc --dvd /mnt/dvd_image
Plays the mounted image with VLC
5. How can I playback audio in multichannel or over S/PDIF?

For S/PDIF, you'll first need to set up the appropriate ALSA settings by running alsamixer (assuming your distro uses ALSA, see Q1 above) and unmuting the S/PDIF output. PCM audio will automatically be played over s/pdif, to play passthrough DTS or AC3 you'll need to specify this setting in the player. In mplayer this is done with the '-ac hwac3' or '-ac hwdts' switches, in VLC the settings can be found in the audio section of the preferences.

For analog multichannel you'll again need to set up the appropriate outputs in alsamixer and you can then specify '-channels 6' in mplayer.

6. How can I play video content over my tv-out in linux?

You'll first want to configure X to run your Tv-out as a second xineramascreen (dual head configuration). There are many guides on the internet for this configuration based on different video card manufacturers, see this LQ wiki page for some starter information. After this is set up you can specify the xineramascreen for playback in mplayer via the '-xineramascreen #' switch or in vlc by the '--x11-xineramascreen #' switch.

Last edited by KpeX; 30th March 2005 at 16:27.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:40   #4  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 3 - General AV Encoding in Linux

For specific encoding information, please see the codec sections that follow.

1. Virtualdub and VFW codecs for windows are great. Is there anything like this for linux?

avidemux2 is an advanced native linux video editing and encoding tool with a GUI interface very similar to virtualdub's. It supports many video codecs and output formats. Unlike virtualdub for windows it is more difficult for codecs to be supported in avidemux, however since it is not VFW based it is free to be much more versatile as far as output formats and advanced video codecs. avidemux supports more codecs and formats with every release and is a great application to get started with encoding video under linux.

Some people have successfully gotten virtualdub working under wine; however, keep in mind that virtually all of virtualdub's tools (aside from proprietary codecs) can be used in native linux apps.

2. What native tools are available for general purpose encoding?

GUI (graphical interface) Tools
  • avidemux2: easy virtualdub-like interface, many filters, codecs, and formats are supported.
  • dvd::rip: A GUI frontend to transcode, built-in DVD ripper, supports many different codecs and output formats.
  • acidrip: a DVD encodeing frontend based on mplayer/mencoder.
  • drip: A DVD to DIVX conversion application, supports MSMPEG4, OpenDivx, XviD for video, MP3 audio, has problems with some NTSC DVDs.
CLI (command-line interface) Tools
  • mencoder: The encoding application paired with mplayer, supports a vast amount of input formats, processing filters, and output codecs, although output container formats are currently limited to AVI and MPEG output format. See here for a tutorial on the command line interface.
  • transcode: a suite of CLI utilities for transcoding video and audio based on a modular structure. Supports many codecs and containers. See the wiki for command line help.
  • ffmpeg: a complete recording, converting and streaming solution, based on libavcodec/libavformat. Supports most of the codecs supported by mplayer as well as a few more container options.
Also see A place to get started (application links)

Last edited by KpeX; 12th October 2005 at 20:55.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:41   #5  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 4 - DVD-Video (MPEG-2) Ripping & Transcoding

1. How can I rip a DVD to my hard drive under linux?

There are several simple dvd-ripping tools available. vobcopy can be used. First you'll want to mount your dvd (assuming the mount point is /mnt/dvd and is set up in your /etc/fstab):
$ mount /mnt/dvd
Then you can rip the main title using vobcopy:
vobcopy -i /mnt/dvd
This will rip the main title only, similar to IFO-mode in DVD Decrypter. if you want to rip the entire disc preserving structure, use
vobcopy -i /mnt/dvd -m
.You can also use dvdbackup from the dvd-create project to rip dvds in a similar fashion.

2. How can I backup a DVD using fast (compressed-domain) transcoding, like DVDShrink?

StreamDVD is a native linux application for transcoding DVDs on the fly. Its advantages are that it does not require the dvd to be ripped, demultiplexed, transcoded, and remultiplexed, rather it reads directly from the DVD and writes a valid DVD vob to standard out that can be piped to dvdauthor. It also has a good quality accurate transcoding engine. Its disadvantages are that it does not handle full discs or menus, but does single titles only. StreamDVD's usage is quite easy (as quoted from the documentation):

When using dvdauthor to build the dvd structure, you can generate a new dvd with only one step. You can pass the complete streamdvd commandline (followed by a '|') to the -f switch in dvdauthor.
i.e.: lets say your dvd drive is accessable at /dev/dvd, the saving directory is /movies/movie1 and you want to backup title 1, all chapters with 1st video and 1st audio track:
dvdauthor -t -o /movies/movie1 -f 'streamdvd -i /dev/dvd -t 1 -s 0xe0,0x80 |'
After that, build the missing ifo files with:
dvdauthor -T -o /movies/movie1
Note that this also requires dvdauthor to be installed, available in many distributions.

At this time streamDVD does not internally support chapters or subtitles. However you can use spumux from the dvdauthor project to mux subtitles, but this will require a full copy of the DVD to your hard drive and more time. As far as chapters go if you extract the chapter points they can be specified in the dvdauthor step, but must be determined beforehand.

You can also encode with streamdvd via the lxdvdrip script.

Additionally, DVDShrink works fairly well under wine, see the section on wine and windows programs emulation for more information.

3. How can I fully reencode a DVD, like DVD-RB under windows?

Unfortunately there is currently no full-disc DVD reencoder comparible to DVD-RB under linux. As far as main movie only reencoding, there are two major mpeg2 encoding libraries (libavcodec and mpeg2enc from the mjpegtools) and many frontends for encoding with both (mencoder, transcode, lxdvdrip, avidemux2, dvd::rip).

4. How can I manually reencode a DVD to DVD-5 or SVCD?

If you're looking for a GUI application, dvd::rip is a great graphical frontend. It can perform the full encoding process for you and even burn SVCDs directly. It's also a good starting point if you want to encode via CLI to get an idea of the steps involved.

For CLI reencoding, there are several steps, and a full guide is outside the scope of this FAQ. But here's a primer on the basic steps: first, rip the DVD to your hard drive as described in question 1 of this section. You can then use mencoder to reencode the video and audio simultaneously, using the -of mpeg switch to output to the MPEG container format. If you're encoding to SVCD remember to reencode the audio to MP2. If you're converting to DVD and want subtitles, demux them from the DVD by using spuunmux from the dvdauthor project, which can then be muxed with your MPG using spumux. Finally create your image file by using vcdimager for (S)VCD's or dvdauthor for DVDs.

5. What options are there for authoring a DVD under linux?

dvdauthor is a full featured dvd authoring toolkit supporting many different DVD options. The command line interface is fairly easy to use for simple authoring tasks and dvdauthor also supports XML configurations for advanced projects. There are also GUI frontends available, check out dvdstyler and qdvdauthor.

6. Are there any advanced DVD/IFO editors available?

PGCEdit by r0lZ is a Tcl/Tk IFO editor that runs natively under linux. The (very simple) installation instructions are available on r0lZ's homepage, and in recent versions the preview will be enabled if you have wine installed (make sure Preview > Use Preview is enabled).

VobBlanker by jsoto, although a native windows program, emulates very well under wine. In recent versions, the preview will work correctly if the overlay is disabled (Settings > More Settings > Check "Do Not Use Overlay").

Last edited by KpeX; 19th May 2005 at 06:24.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:42   #6  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 5 - DV / Digital Camcorder Encoding

For general DV information, see bb's DV FAQ

1. What programs to I need to setup to rip and encode video from my camcorder?

The basic libraries you'll want are libdv (DV-format decoding library), libraw1394(IEEE-1394/firewire hardware access library), and libavc1394 (AVC control library, so you can play and pause your camera via computer control).

Please note that many broken libraw1394 packages do not properly setup the /dev/raw1394 device. If you encounter problems when running dvgrab, kino, or other DV capturing programs regarding the raw1394 interface, try the following commands to create the /dev/raw1394 device:
# /bin/mknod -m 600 /dev/raw1394 c 171 0
# /bin/chown root:root /dev/raw1394
You can also create this device by running 'make dev' from the libraw1394 source tree.

2. What programs can I use to capture/edit DV video?

After the above mentioned libraries are installed, you can use dvgrab to capture DV video via commandline or kino for a graphical interface (kino is a nice video editor as well).

Using dvgrab from commandline is fairly easy and intuitive. A good way to start is to connect your camera to your IEEE1394 port and start by running
dvgrab -i --format dv2 output.avi
This will start dvgrab in interactive mode (type ? to see camera controls) using type-2 AVI as output. See 'man dvgrab' for more information.

Kino is also a great choice for a graphical capturer/editor - its interface is rather intuitive and easy to use.

3. What programs can I use to further process / encode my DV video?

The mjpegtools provide a set of useful command line apps for processing DV (and other) video. The tools are set up so that they can be used in a pipe sequence for video processing. For example you can use lav2yuv to decode DV video to YUV, yuvscaler to resize the video, and mpeg2enc to encode to mpeg-2 video (all these apps are part of the mjpeg suite). 'man mjpegtools' will give you a good tutorial for using the different utilities. mjpegtools also includes the lav2mpeg bash script utility to automate the encoding steps for you for different targets (vcd,svcd,mpeg1/2). Note that you'll need to make sure your version of mjpegtools is compiled with DV video support (using libdv) in order to encode DV. If you're compiling from source, you can add the '--with-dv' option to mjpegtools' configure script. See 'man mjpegtools' and http://mjpeg.sf.net for more help.

Additionally, when configured with libdv support, mplayer/mencoder can be used to play, filter, and transcode DV video to any of mplayer's supported codecs.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:43   #7  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 6 - MPEG-4 Video Encoding

For general MPEG-4 information, see bond's MPEG-4 FAQ

1. What MPEG-4 codecs are available for encoding under linux?

MPEG-4 ASP / MPEG-4 Part 2 codecs
  • XviD - High-quality advanced GPL MPEG-4 ASP codec, included in many distributions, fast and excellent quality. Supported in mplayer, ffmpeg, transcode, dvd::rip, and many other applications
  • libavcodec - MPEG-4 ASP is one of the codecs supported by the libavcodec library, very fast and highly configurable, good quality, the range of options can be a bit intimidating to linux newbies at first. Supported in mplayer, ffmpeg, transcode, and many other applications
  • OpenDivx / ProjectMayo / divx4linux - various Early DivX codec implementations for linux, not nearly as good as xvid or libavcodec, supported in mplayer and others
MPEG-4 AVC / H.264 / MPEG-4 Part 10 codecs
  • x264 - GPL H.264 / AVC codec, probably the best open-source H.264 encoder, fast, early in development but becoming more advanced very quickly, available in mencoder, VLC, or its native commandline interface.
2. What's the easiest way to backup a DVD to mpeg-4?

dvd::rip is a full featured GUI for DVD ripping and supports many different codecs and audio formats. Also see the 'General Encoding' section above for more GUI links.

If you want to go through the process yourself, check out Mosu's DVD transcoding guide for a great walk through of all the steps involved. A quicker overview by Nico is available here.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:44   #8  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 7 - Advanced Container Formats

1. How can I mux and playback matroska (MKV, MKA) files?

mkvtoolnix, the matroska toolkit builds natively under linux (both GUI and CLI interfaces), providing an easy way to create matroska files from many different codecs. See the mkvtoolnix homepage above for links to binaries and sources.

Playback of matroska files is supported in mplayer, VLC, and other players.

See the matroska FAQ for general matroska information.

2. How can I mux and playback MP4 container format files?

gpac provides an advanced MPEG-4 toolkit, including the MP4Box information and muxing tool and the Osmo4 MP4 player. ASP, AAC, and MP3 can be muxed using MP4Box. Note that MP4Box also removes packed bitstream and other AVI hacks from MPEG-4 in AVI.

mpeg4ip provides open source encoding, muxing, playback, and streaming tools for MP4. AVC, HE-AAC, LC-AAC, ASP and other formats can be muxed using mp4creator included with mpeg4ip.

MP4 playback is also supported in mplayer and VLC.

See the MP4 FAQ for more information on the MP4 container format.

3. How can I mux and playback OGM container format files?

OGMTools is a native linux tool supporting creation of, extraction from, and information about OGM files.

OGM is supported for playback in mplayer, VLC, and others.

See the OGM FAQ for more information on the OGM container format.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:45   #9  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 8 - Audio Encoding

[size=1.5]See the Audio FAQ for general audio information.[/size]

1. What applications can I use for CD-Audio ripping (digital extraction) and encoding?

cdparanoia is currently the most accurate native linux ripping tool available. Its commandline interface is fairly easy to use, but it is also available in several GUIs.

grip is a fully featured graphical CD-ripper that has built-in cdparanoia support, ID3 tag support, and can be configured to encode virtually any format you want.

2. Is there a good audio editor available?

audacity is an open source audio editor that supports recording, conversion, and editing of ogg vorbis, MP3, and WAV audio, and supports a vast array of audio filters and plugins. Source and binary packages are available on their homepage.

3. What tools can I use to extract an audio track from AVI/MKV/MP4?

  • AVIdemux2: Graphical interface
  • avi2raw: A tool included with the mpeg4ip package, use with the --audio switch
  • mplayer: can be used for AVI and other formats with the -dumpstream option
  • mkvextract: included with the mkvtoolnix package, can demux almost any matroska stream
  • mp4creator: part of the mpeg4ip package, use with the -extract=trackid option
  • MP4Box: included with the GPAC project, see 'MP4Box -h extract' for information
4. What encoders are available for various audio formats?

Lossy Formats
  • lame: highest quality MP3 encoder
Ogg Vorbis:AAC:
  • FAAC: Freeware Advanced Audio Coder
  • libavcodec includes an AC3 encoder, available in ffmpeg and others
Lossless formats
  • Wavpack: Advanced lossless encoder featuring a unique hybrid mode. CLI encoder is available under *nix.
  • FLAC: Free Lossless Audio Codec, one of the best and most supported lossy formats. CLI encoder builds under *nix, plugins available for xmms, amarok, and more.

5. How can I play AC3/DTS over S/PDIF (digital) output?

All the popular players for linux (xine, mplayer, vlc) include AC3 decoding support 'out of the box'. For s/pdif output, your player will need must also be ALSA (advanced linux sound architecture) compatible. Steps to using alsa are as follows:

1. Make sure your sound card is supported by checking alsa-project.org.

2. Make sure your kernel has alsa support compiled in. ALSA is the default sound architecture in the 2.6.x kernels, and many 2.4 kernels shipping with distributions are compiled with alsa built-in.

3. Install software & set up your soundcard: make sure you have the alsa-driver, alsa-lib and alsa-utils installed (may be called something else in different distributions) and run alsaconf. You will be prompted to select your soundcard. If you have no error messages, then run alsasmixer to set your default levels. Make sure to activate the S/PDIF output if you wish to use it. On my card, this is referred to as "IEC958 output".

4. Install a player with alsa support. The simplest way to see if mplayer has alsa support is to type 'mplayer -ao help' and see if alsa is one of the choices. If your mplayer does not contain alsa support, simply build mplayer from source, and if you have alsa-lib (+ alsa-lib-devel on some platforms) mplayer will detect and compile in alsa audio out support. Then add a '-ao alsa' to your playback command or your mplayer.conf file, and the alsa output will be used. To playback AC3 over spdif, you'll also need to add a '-ac=hwac3' switch to your commandline. Alternatively you can add 'ac=hwac3,' to your mplayer.conf file (note the comma after hwac3), which will cause mplayer to try ac3 pass through first on any file and then other codecs.


6. How can I losslessly raise the volume of my MP3/OGG/WAV audio?
  • MP3: MP3Gain supports analysis and lossless gain of MP3 files
  • Ogg Vorbis: vorbisgain calculates a replaygain value and stores it in the header of OGG files
  • WAV: normalize can be used to normalize WAV audio
7. How can I split my MP3/OGG/WAV audio?

Try mp3splt for MP3 or OGG audio or wavsplit for WAV audio.

Last edited by KpeX; 2nd April 2005 at 19:11.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:46   #10  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 9 - CD / DVD Burning

1. Do I need to set up any special kernel options to enable CD/DVD burning?

If you're running a fairly recent kernel, probably not. Older kernel versions required scsi-emulation to be set up for the drives, but recent versions support direct ATAPI/IDE access. If you're using a 2.6.x version kernel, you almost certainly are ready to go. An easy way to test if direct ATAPI access is available is to install cdrecord (mentioned below) and issue the command
 $ cdrecord -dev=ATAPI -scanbus
If your drives are mentioned in the scan output, you're ready to go.

2. How can I burn CDs/DVDs under linux?

Burning Software:
  • xcdroast: an easy to use graphical front end for the cdrtools and cdrecord-prodvd. Originally based on the SCSI emulation interface to IDE, so it can be a quite unresponsive interface at times.
  • k3b: A KDE-based burning frontend, similar interface to Nero. Slightly more user friendly than xcdroast but has fewer options. However, in most cases it is much faster and more useful (uses dvd+rw-tools for dvd burning and ide-cd access).
  • cdrtools: A helpful cd burning toolkit, includes mkisofs for creating images. Example commandlines:
    # mkisofs -dvd-video -V MY_VOLNAME -o dvdvideo.iso /path/to/video/
    Creates a DVD-Video image called dvdvideo.iso with 
    volume name MY_VOLNAME from the /path/to/video/ folder
    # cdrecord -dev=/dev/hdd -dao image.iso
    burns the imagefile image.iso in Disk-At-Once mode to the /dev/hdd drive
  • cdrecord-proDVD: The DVD-enabled version of cdrtools, requires a (freely available) key for images over 1 gig. Syntax is similar to cdrtools.
  • dvd+rw-tools: A DVD burning kit that includes support for both DVD+R and DVD-R and changing the booktype of DVD+ media. Example commandline:
    # growisofs -Z /dev/hdd=image.iso
    burns the imagefile image.iso to the drive /dev/hdd
2B. How can I get the media code (disc identifier) of a blank DVD+/-R?

Once again the dvd+rw-tools are helpful in this regard - the command
$ dvd+rw-mediainfo /dev/dvd
where /dev/dvd is your DVD drive containing the media in question will spit out among many other pieces of information the media identifier code of the DVD blank.

3. What linux applications support dual layer DVD discs?

Although I haven't personally tested it, the dvd+rw-tools mentioned above support dual layer discs (as well as k3b, which is a frontend for the dvd+rw-tools).

4. What linux applications support booktype / bitsetting?

Recent version of the dvd+rw-tools (mentioned above) support dvd-rom booktype modification for both DVD+R and DVD+RW media. Bitsetting command line examples:
# dvd+rw-booktype -dvd-rom -media /dev/hdd
Set the booktype of a DVD+RW disc to dvd-rom

# dvd+rw-booktype -dvd-rom -unit+r /dev/hdd
if issued before burning, this command instructs 
the drive at /dev/hdd to set the booktype to dvd-rom 
(blank media must be in drive)
5. How can I create / play XCDs?

mode2cdmaker can be used to create 800MB xcd images from any media content. Make sure not to use the -s switch when creating XCD images (the default under some windows GUIs) because using only one track will render the XCD unreadable under current linux drivers. An example commandline is:
$ mode2cdmaker -m moviefile.mkv -v MY_TITLE -e DAT -o myimage
Creates an imagefile with basename myimage and volume ID 
MY_TITLE adding moviefile.mkv as a form-2 file with an 
extension of .DAT for mode 2 files.
To playback an XCD, simply issue the mplayer command:
$ mplayer vcd://2 -cdrom-device /dev/hdc
where /dev/hdc is the device file of the CD-ROM drive that contains the XCD. Mplayer should auto detect the file format.

Last edited by KpeX; 19th May 2005 at 06:31.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:46   #11  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 10 - Installing wine & emulating windows programs

1. Despite all these great native linux applications, there's still some windows app I want to use. What can I do?

wine is an open source implementation of the Windows API on top of linux and X. The developers would prefer you think of it not as an emulator but as a compatibility layer for running windows programs. Wine is still in heavy development and considered pre alpha software, keep that in mind when problems occur.

Installing Wine

Many distributions now include binary wine packages; however, I strongly recommend compiling it from source; on every box I've installed it on a source installation works better. Make sure the development packages from your distribution have been installed, and then you can either download the latest wine snapshot from here and untar it:
$ tar xvzf wine-20xxxxxx.tar.gz
$ mv wine-20xxxxxx wine
or check out the latest CVS of wine:
$ export CVSROOT=:pserver:cvs@cvs.winehq.org:/home/wine
$ cvs login
$ cvs checkout wine
The password is 'cvs' (no quotes). Later when you want to update your source, you can just enter the command:
$ cvs update -PAd
from the wine source directory.

You'll now have a wine/ directory (either from tarball or CVS) containing the wine source code. Wine is always in heavy development and is still considered alpha software, keep that in mind.

Now, from the wine directory, run
$ ./tools/wineinstall
This will first configure wine and then ask you if you want to build wine, su root, and install wine. Enter 'yes' and then sit back and wait while wine compiles. After it's finished wine will ask you for your root password, enter it and wine will be installed.

Wine will then ask if you want to create a ~/.wine/config file; say yes. The wine installer will then search for an existing 'real' windows installation on your hard drive, and ask if you want to use it for the wine install. Saying 'yes' to this option usually causes lots of problems, it's usually much stabler and safer to say 'no' and wine will create a clean install. Wine will then ask you where you want to put your 'fake' C:\ drive, you can stick with the default ~/.wine/drive_c.

Now your wine install should be complete. You can test it by running the wine-built in 'notepad' command. If a window that looks something like windows notepad.exe pops up, you're in good shape.

Configuring Wine

Now before we install any programs, we'll need to modify our config file and set up our wine virtual devices. Open up the ~/.wine/config file we created earlier, and scroll down to the '[Version]' section. The emulated Windows version that works best depends onthe application used. nt40 works well for many dvd-based apps. If you change this line make sure you uncomment it (remove the semicolon at the start). The start of your version section might then look something like this:
; Windows version to imitate 
"Windows" = "nt40"
This is the only change I normally make in my config. If you read through the rest of the file the rest of the options are fairly self explanatory. Save and close the file.

We'll now need to set up wine to recognize our hardware. Change to the ~/.wine/dosdevices/ directory:
$ cd ~/.wine/dosdevices/
Virtual wine drives in this section are set up with symbolic links. To set up a drive linking to a directory, use a symbolic link like a: If the directory is the mount point for a device, link to the mount point with b: and the device file with b:: For example, to set up a virtual drive at c: pointing to a folder /path/to/folder on your hard drive, execute the command
$ ln -s /path/to/folder c:
To set up a virtual drive at d: pointing to a drive /dev/hdc mounted on /mnt/cdrom, execute the commands
$ ln -s /mnt/cdrom d:
$ ln -s /dev/hdc d::
Set up links in this fashion for all drives you want to access for wine. My dosdevices directory looks like this:
$ ls -l ~/.wine/dosdevices/
a: -> /mnt/floppy/
a:: -> /dev/fd0
c: -> ../drive_c/
d: -> /d
g: -> /mnt/dvd
g:: -> /dev/hdc
h: -> /mnt/dvdrw
h:: -> /dev/hdd
z: -> /
You can test if these drives have been set up properly by running notepad again and checking if you can read files in the various drives. Now we should be all set to install programs.

2. What applications work well under wine?

This is not a black and white question, it depends on your config, your kernel, your wine version, and possibly other factors. The best place to start when you encounter problems with a specific app is to start researching. Some good places to research wine problems:

Last edited by KpeX; 30th May 2005 at 21:32.
KpeX is offline   Reply With Quote
Old 23rd March 2005, 04:48   #12  |  Link
Registered User
KpeX's Avatar
Join Date: Jun 2003
Location: Great Lakes, USA
Posts: 1,433
Part 11 - Credits & Changelog

My thanks to the following FAQ/forum contributors, in no particular order.

Neo Neko

  • 03.22.05: Inital Public posting.
  • 03.30.05: Added Q4B to the playback section, playing an ISO DVD image.
  • 04.02.05: Added some lossless encoder links to the audio section.
  • 04.06.05: Added Q2B to the burning FAQ, DVD media identifier.
  • 05.19.05: Added P4Q6: IFO editors.

Last edited by KpeX; 19th May 2005 at 06:24.
KpeX is offline   Reply With Quote
Old 2nd December 2007, 17:09   #13  |  Link
Registered User
rootkit's Avatar
Join Date: May 2006
Posts: 24
Originally Posted by KpeX View Post

  • FAAC: Freeware Advanced Audio Coder
 .""`.    Matteo Croce
: :"  :   proud Debian admin and user
`. `"`
  `-  Debian - when you have better things to do than fix a system
rootkit is offline   Reply With Quote
Old 14th March 2008, 13:51   #14  |  Link
Registered User
karasu's Avatar
Join Date: Jun 2006
Posts: 111
You can add Handbrake CLI (and GUI in a near future) as an easy DVD backup solution. Mpeg4 ASP/AVC output.
karasu is offline   Reply With Quote
Old 23rd June 2008, 17:56   #15  |  Link
Registered User
Henrikx's Avatar
Join Date: Aug 2005
Location: Germany
Posts: 306
and GUI in a near future
Future is now
svn co svn://svn.handbrake.fr/HandBrake/trunk hb-dev

cd /hb-dev

./configure && jam

cd /hb-dev/gtk



make install (root), or

cd /hb-dev/gtk/src


Handbrake with GTK GUI

THX to Muchbuckdi for the tip! (German)

Last edited by Henrikx; 29th June 2008 at 15:50.
Henrikx is offline   Reply With Quote
Old 13th February 2009, 12:47   #16  |  Link
Registered User
kozaki's Avatar
Join Date: Apr 2008
Posts: 5
As for #3 MPlayer compilation it now uses SVN:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

And 'svn checkout' (or 'svn update' in this case) looks like it includes libavcodec:
Récupération de la référence externe dans 'libavcodec'
D libavcodec/xvmcvideo.c
D libavcodec/xvmc_render.h
U libavcodec/vp6.c
U libavcodec/resample2.c
Référence externe actualisée à la révision 17209.

EDIT : But comparing SVN-mplayer/libavcodec with SVN-ffmpeg/libavcodec shows 6.934.604 bytes in 711 files vs 96.714.591 bytes in 358 files.
Shall i replace mplayer's with ffmpeg's libavcodec sources, or merge them?

Last edited by kozaki; 13th February 2009 at 13:30. Reason: additionnal details on mplayer's vs ffmpeg's libavcodec
kozaki is offline   Reply With Quote

faq, linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 02:25.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.