[ Prev ] [ Index ] [ Next ]

dvd/cd

Created Tuesday 7/8/2007

This document describes general cd/dvd media usage within linux, with an emphasis on Fedora Core. The document covers burning DVD and CDR/RW media, encoding (transcoding, ripping) to different forms (DVD to AVI and vice-versa). Several media players and codecs are covered as well as the linux DvdCSS library.

1. Burning ISO images

Programs such as cdrecord, mkisofs, gcombust and etc can used to write cd images. The most common method for creating a CD-RW is to first generate an ISO image of the contents that are to be written to the CD and then to write that ISO image so the CD media. The following steps use mkisofs(1) to create the ISO file and then use cdrecord(1) to write the ISO to the CD or DVD media.

The following options to mkisofs will create an ISO image in joliet form:

bash$  mkisofs -o /tmp/cdimage.iso -J path/to/data 

Or to create an ISO9690 image:

bash$ mkisofs -o /tmp/cdimage.iso -iso-level 4 path/to/data 

Then the following command will write an existing ISO image to cd media in the device loaded in the tray of /dev/cdrom:

bash$ cdrecord -v -eject dev=/dev/cdrom speed=12 -data /tmp/cdimage.iso 

2. Mouting ISO images

ISO images can be mounted and used like a normal disk device. To do this, mount the iso, like this:

bash # mount -o loop -t iso9660 /tmp/image.iso /mnt/iso

3. Extracting cpio archives

cpio(1) is used to manipulate cpio archives. The Oracle distribution, for some reason, uses cpio,. These are pretty much like tar archives and can be extracted with a command such as:

bash$ cpio -idcmv < somefile.cpio

CPIO is quite useful in some cases. For example an rpm archive can be converted to cpio using rpm2cpio(1). The cpio archive can then be extracted and manipulated.

4. Writing a CD-RW with Fedora Core

4.A. Matshita (Panasonic) UJ-810

The Matshita UJ-810 is a 1x dvd-R drive and can write cds at a maximum of 16x for CDR. For CDRW the write speed is 8x. With Fedora Core, cd media can be written to in a number of ways: using Nautilus's CD Creator feature (choose Places->CD Creator) or from the command line with cdrecord(1). Specs for UJ-810 are at the Panasonic site, here.

Technical Spec:
    DVD-R write at 1x
    DVD-RW write at 1x
    CD R write at 16x
    CD RW write at 8x
    DVD Read at 8x
    CD Read at 24x
    IDE/ATAPI Interface
Physical Spec:
    12.7 mm height
    Power Requirement voltage DC 5V +/- 5%
    Operating temperature 5 to 50 C
    Weight 210g
    Media: DVD-ROM, DVD-Video, DVD-R, DVD-RW, DVD-RAM, CD-DA,
    CD-Extra, CD-ROM (Mode 1, Mode 2, Form 1), CD-ROM XA (Mode 2, Form 2)
    Photo CD (Single + Multi session), Video CD, CD-Text
Company Spec:
    Panasonic - Kyushu Matsushita Electric Co. Ltd.
    Devices and Components Division
Contact: 
    Panasonic Industrial Co.
    2033 Gateway Place, Suite 200
    San Jose, CA 95110
    tel: +1 408 287 9514
    fax: +1 408 436 8495
    email: berzind@panasonic.com

4.B. LG GSA-H20L (GSA-4166B) DVD-RAM

This is an LG unit that is identical to the GSA-4166B, which is Super Multi DVD-Writer with LightScribe. This drive supports 16x DVD+R/-R, 8x/6x DVD+RW/-RW, 5x DVD-RAM, 8x/4x DVD+R DL/-R DL writing and LightScribe Direct Disc Labeling. A detailed review can be found in this cdfreaks article however, a summary of the technical specs are:

Write Speed (DVD+R) 2.4x, 4x CLV, 8x ZCLV, 12x PCAV, 16x CAV
Write Speed (DVD+R DL) 2.4x , 4x CLV, 6x, 8x ZCLV
Write Speed (DVD-R) 2x, 4x CLV, 8x ZCLV,12x PCAV, 16x CAV 
Write Speed (DVD-R DL) 4x CLV
Write Speed (DVD+RW) 2.4x, 4x CLV, 8x ZCLV
Write Speed (DVD-RW) 1x, 2x, 4xCLV, 6x ZCLV 
Write Speed (DVD-RAM) 2x, 3xCLV, 5x PCAV(Ver.2.0&Higher) 
Write Speed (CD-R) 16x CLV, 24xZCLV, 40x, 48x CAV 
Write Speed (CD-RW) 4x, 10x,16x CLV,24x,32x ZCLV (High Speed: 8x, 10x, Ultra Speed > 16x)
 Read Speed (CD-ROM) Max 48x
 Read Speed (DVD-ROM) Max 16x 
Write Method(DVD-RAM) Random write 
Write Method(DVD-R/RW) Disk-at-Once, Incremental Recording Restricted Overwrite (DVD-RW only)
Write Method(DVD+R) Sequential Recording 
Write Method(DVD+RW) Random Write
Write Method(CD-R/RW) Disk-at-Once, Track-at-Once Session-at-Once,
                      Packet Write Data Transfer Rate(CD) Max 7,200KB/s,
                      DVD: Max 22.16 Mbytes/s
 Access Time(CD) CD: 120 ms, DVD-ROM(SL/DL) 140/175 ms, DVD-RAM 250 ms
 Buffer Size 2MB with buffer under run prevention technology
 Loading Type Motorized Tray
 Interface Type E-IDE / ATAPI
 Compatible Formats Write DVD-RAM, DVD-R/RW, DVD+R/RW, CD-R/RW
 Compatible Formats Read DVD-RAM, DVDR/RW, DVD+R/RW, DVD-ROM CD-R/RW, 
                    CD-ROM Mode 1, 2 CD-DA, CD-IFMV CD-ROM XA, Mixed CD,
                    CD-Extra, CD-Text CD-Plus, Photo-CD, Video CD 
 Dimensions(WxDxH) 146 x 165 x 41.3 mm
 Weight 770g+/-30g (Net)

4.C. Writing a CD/DVD

Use the cdrecord(1) app, as a privledged user, to write DVD and CD media using UJ-810. This is quite a simple process, in which either the LUN or the device is specified with cdrecord's -dev option.

Tip: The UJ-810 supports writes at 16x, but it may have problems with some media at this speed. Try a slower speed like 12x or 8x:

bash# cdrecord dev=/dev/hdc -v speed=16 image.iso

The cdrecord(1) man page says stuff about specifying the device to burn to (with the dev= option) in scsi format. To do this, identify the scsi bus, target and lun with:

bash# cdrecord -scanbus
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
cdrecord: Warning: using inofficial libscg transport code 
version (schily - Red Hat-scsi-linux-sg.c-1.83-RH 
'@(#)scsi-linux-sg.c 1.83 04/05/20
Copyright 1997 J. Schilling').
scsibus1:
        1,0,0   100) 'MATSHITA' 'UJ-810  ' 'C102' Removable CD-ROM
        1,1,0   101) *
        1,2,0   102) *

In which case dev=/dev/hdc is replaced with dev=-2,-2,-2

4.B. ATA/ATAPI/SCSI

The cdrecord(1) -scanbus feature is used to identify devices. The device types that are searched for depend on the version of cdrecord that is installed. For example, building cdrecord from source assumes SCSI device types, which require the generic scsi driver sg (which must be loaded with modprobe(1).

4.B.1. Listing ATA devices

Use the -scanbus option of cdrecord, running in ATA mode. The scanbus operation requires privledged user access:

bash # cdrecord dev=ATA -scanbus

4.B.2. Listing ATAPI devices

Use the -scanbus option of cdrecord(1), running in ATAPI mode:

bash # cdrecord dev=ATAPI -scanbus

4.B.3. Listing SCSI devices

The sg driver (which is the generic SCSI) driver be be loaded before the SCSI device list can be produced. As root, load the generic driver with modprobe(1):

bash # modprobe sg
bash # cdrecord dev=SCSI -scanbusd

5. Writing a DVD with Fedora Core and a Matshita (Panasonic) UJ-810

The UJ-810 does not support Track-At-Once (-tao) mode, which is the default write mode. Instead, specify Disk-At-Once (-dao) when writing an iso image. The UJ-810 is a DVD-R (minus R) drive and supports write speeds of 1x only. Successful DVD write operations have been performed with early versions of the Fedora Core 2.6 kernel (E.g., 2.6.11-1.27_FC3) using 120 minute 4.7 GB DVD-R media.

To write an ISO image using the UJ-810, insert DVD-R media into the drive and then, as root, run cdrecord, indicating the ISO to write:

bash# cdrecord dev=/dev/hdc -dao -v FC4-i386-DVD.iso

5.B. Using growisofs

Growisofs can be used to write ISO images as well. The following is the command K3B used to burn a particular set of files, note the files in /tmp/kde-foo are: ▢ /tmp/kde-foo/k3bSNz8gc.tmp —▶ empty ▢ /tmp/kde-foo/k3bnZCOya.tmp —▶ empty ▢ /tmp/kde-foo/k3bClo3Xa.tmp —▶ contains pathnames of files to write

bash $ growisofs -Z /dev/scd0 -use-the-force-luke=notray -use-the-force-luke=tty -speed=16 -gui \
 	-graft-points -volid Video and avi Disk 2 -volset -appid K3B -publisher Joslyn PC 20-Oct-2006 \
 	-preparer Stuart Moorfoot <foo@bund.com.au> -sysid Fedora Core GNU Linux -volset-size 1 \
 	-volset-seqno 1 -sort /tmp/kde-foo/k3bSNz8gc.tmp -rock -hide-list /tmp/kde-foo/k3bnZCOya.tmp \
 	-joliet -joliet-long -hide-joliet-list /tmp/kde-foo/k3bO3Ka2a.tmp -full-iso9660-filenames \
 	-allow-lowercase -iso-level 2 -path-list /tmp/kde-foo/k3bClo3Xa.tmp 

6. Writing DVD's and CD's with k3b

The KDE CD/DVD writing app K3B is awesome, very easy to use and is feature packed. K3B is essentially a Front End, which uses the DVD and CD libaries as encoders such as growisofs, cdparanoia and dvdcss. The application itself is self explanatory and a wizard allows the user to quickly setup a write/burn session for type of media they are writing to. K3B burns ISO images to DVD and CD media and, significantb can be run as a non-priviledged user.

7. VLC (previously VideoLAN Client)

yum package info VLC: ▢ VLC is a Multi-platform MPEG, DVD, and DivX player and is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, and etc) as well as DVDs, VCDs, and various streaming protocols. It can also be used as a server to stream in unicast or multicast in IPv4 or IPv6 on a high-bandwidth network.

8. Encoding/Ripping

8.A. The Transcode tool

yum package info for transcode: ▢ transcode is a text console video-stream processing tool. It supports elementary video and audio frame transformations. Some example modules are included to enable import of MPEG-1/2, Digital Video, and other formats. It also includes export modules for writing to AVI files with DivX, OpenDivX, XviD, Digital Video or other codecs. Direct DVD transcoding is also supported. A set of tools is available to extract and decode the sources into raw video/audio streams for import and to enable post-processing of AVI files.

8.B. Xvidcore

yum package info for xvidcore: ▢ Xvidcore is a free reimplementation of the OpenDivX video codec. You can play OpenDivX and DivX4 videos with it, as well as encode compatible files.

8.C. AVIdemux

yum package info for avidemux: ▢ Avidemux is a graphical tool to edit AVI. It allows you to multiplex and demultiplex audio to/from video. It is able to cut video, import BMP, MJPEG and MPEG video, and encode them. You can also process video with included filters. It requires a DivX compatible encoder and the Gimp Toolkit (GTK) libraries.

8.D. DVD:Rip

DVD:Rip is packaged for Fedora Core as perl-Video-DVDRip and is available from Livna.org . The yum info for dvd rip says: ▢ dvd::rip is a full featured DVD copy program written in Perl. It provides an easy-to-use but feature-rich GTK+ GUI to control almost all aspects of the ripping and transcoding process. It uses the widely known video processing swissknife, transcode, and many other Open Source tools.

8.E. Divx4Linux

DivX for Linux codec binaries. This archive includes the binary release of the DivX Codec 5.0.5 for x86 Linux. See http://www.divx.com/divx/linux

8.F. LibFame

The libfame library is used for fast (real-time) MPEG video encoding. The package is written in C and assembler and allows encoding of fast MPEG-1 video as well as MPEG-4 (OpenDivX compatible) rectangular and arbitrary shaped video.

8.G. Gnome Subtitle Editor

The Gnome Subtitle Editor (gsubedit) is a tool for editing and converting DivX subtitles. It has read and write support for SubRip (.srt) and MicroDVD (.sub) subtitles. Framerate conversion and frame displacement are also supported. The gsubedit rpm is packaged and maintained by Livna.org.

9. Media players

This section is an overview of media players, such as Helix, mplayer, xine and etc as well as codecs, libraries and drivers like FAAC, GStreamer and DVDcss.

9.A. LibPostProc

Media players like MPlayer require post processing libraries in order to play dvd/avi/vcd content. The libpostproc package contains only MPlayer's libpostproc post-processing library which other projects such as transcode may use. The libpostproc package must be installed to use MPlayer, Transcode and similar programs.

9.B. mplayer/gmplayer

mplayer is a command line tool that supports multiple formats such as VOB (DVD), AVI, VCD, RM (Real Media) and more. The graphical front end is gmplayer

yum package info for mplayer: ▢ MPlayer is a movie player that plays most MPEG, VOB, AVI, OGG/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM, RoQ, and PVA files. You can also use it to watch VCDs, SVCDs, DVDs, 3ivx, RealMedia, and DivX movies. It supports a wide range of output drivers including X11, XVideo, DGA, OpenGL, SVGAlib, fbdev, AAlib, DirectFB etc. There are also nice antialiased shaded subtitles and OSD.

9.B.1. Downloading MPlayer CVS

Note: The cvs repository is now deprecated, use svn instead Note: This cvs section is no longer relevant, refer to the svn section 9.B.2 and see mplayer

You can also get MPlayer via anonymous CVS. Issue the following commands to get the latest sources:

cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer login
cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer co -P main

When asked for a password, just hit enter. A directory named main will be created. You can later update the sources by typing (within main):

cvs -z3 update -dPA
FFmpeg (includes libavcodec/libavutil/libavformat)

CVS MPlayer is not fully functional without a copy of the libavcodec, libavformat and libavutil libraries from FFmpeg. Get FFmpeg CVS via the following cvs commands:

cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login
cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -P ffmpeg
(or "cvs -z3 update -dPA" after login to update sources)

When asked for a password, just hit enter. A directory named ffmpeg will be created. Copy the libavcodec, libavformat and libavutil subdirectories into the main directory just created from the MPlayer checkout.

In order to include libavcodec and libavutil in CVS updates, add the following lines to main/CVS/Entries:

D/libavcodec////
D/libavformat////
D/libavutil////

9.B.2 Downloading mplayer via svn

A subversion repository for Mplayer is also available. The following svn commands will checkout the lastest version from the rep repository:

bash $ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

A directory named mplayer will be created in the current directory. The mplayer source can be updated by issuing:

bash $ svn update

From within the svn created mplayer directory. The sources contain the libav* directories from FFmpeg, so these do not need to be download separately.

9.B.3 Compile mplayer

Be sure that the following libraries and headers are installed (e.g., something.x86_64 and something-devel.x86_64) Note live-devel installs the live555 streaming audio codecs and there is no non-devel component for this): ▢ a52dec ▢ faac ▢ faad2 ▢ ffmpeg ▢ gsm ▢ lame ▢ libdvdread ▢ libmad ▢ libmp4v2 ▢ xvidcore ▢ lame-libs ▢ live-devel ▢ transcode ▢ libquicktime ▢ libquicktime-utils ▢ speex ▢ directfb ▢ aalib ▢ libcddb ▢ libdvdnav ▢ libdv ▢ libmpcdec ▢ ladspa ▢ x264

Download and install the mplayer codecs (they call these the essential codecs):

bash $ wget ftp://ftp1.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2

The codec installation directory is unimportant as any location will do. A user-compiled version of MPlayer uses /usr/local/lib/codecs as the default codec location. If the codecs are installed elsewhere, then be sure to tell configure where the codecs are with the --codecsdir option. Ten run the configure script and install:

bash $ ./configure --enable-gui --codecsdir=/usr/local/lib/codecs
bash $ make
bash $ sudo make install

The default prefix is /usr/local, which can be changed with the --prefix option to configure. Be sure to set the system config directory as well. Typical settings for --prefix=/usr with system configuration in /etc (--sysconfdir=/etc). See section #4.A of gnu.

9.C. EMovix

eMoviX is a tiny Linux CD distribution containing all the software to boot from a CD and play automatically every video file localized in the CD root. It Supports all the formats covered by MPlayer, most noticeably DivX & XviD but more in general most AVI, MPEG, QuickTime, WMV, ASF, FLI and a few others. Subtitles can be automatically loaded and displayed if a subtitles file exists in the same position with the same name (e.g., movie.avi and movie.sub). The Fedora Core rpm for EMovix is packaged by Livna.org.

10. DVD Player Bellagio P807

This is a cheap DVD player found mostly in Europe. It has remote-settings for changing the DVD region (e.g., to Region-0 multiregion/codefree).

Image: #hardware.Bellagio_P807_DVD.jpg

10.A. Region Free

The bellagio P807 is a Gericom 2.0 ch dvd player and as such, the DVD Region settings (regions 0-6) can be controlled via the following:

10.B. Remote control codes

The P807 remote control codes (generated by lirc) are listed in #hardware.bellagio_P807_lirc_remote_code.txt

10.C. Codebase - DVD Control

The update is in the *.PDB file, see #hardware.DVD_dvd_bellagio-p807.PDB (This is probably not really a good idea - remove this, try lirc instead)

Todo: Review this - possibly deprecated now

11. Converting AVI to DVD

This article (also locally here as PDF) has a step by step approach to converting avi to dvd (vob) and for creating dvd menus with audio (sourced from the Mighty Legends site).

Stuart Moorfoot © 7 August 2007 foo@bund.com.au


Backlinks: :Home :avi :cdrw :mplayer