Monday, October 27, 2008

From AVI to DVD Video

So, here i am, stucked with several avi files, and i need to burn these files as DVD videos for my parent's friends. And i've never before done this kind of thing on a linux pc.

After doing some research, here are the steps i took to make this work :

1. Convertion from AVI files to MPEG files
We need to convert the AVI files to MPEG files, and i use mplayer for this. Here's my example script of convert.sh (NOTE : please aware that the vcodec parameter is too long for a good view, so i truncate it into several lines. So the lines ending with 4016: actually continues to keyint=12 without a new line, and line that ends with cbp: continues to mv0: without a new line)

mencoder -of mpeg -mpegopts format=dvd:tsaf -ovc lavc -oac lavc -vf harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vstrict=0:vbitrate=4016:
keyint=12:aspect=16/9:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:
mv0:vqmin=1:lmin=1:dc=10:acodec=ac3:abitrate=192 -ofps 30000/1001 $1.avi -o $1.mpeg

So in my case i would do this command for my opening.avi file to get an output file of opening.mpeg

$ ./convert.sh opening

The output of this step is MPEG file[s]

2. Make a DVD filesystem
In this step i use the dvdauthor software to achieve this. Here's an example script of mine (makedvd.sh) :

dvdauthor -o dvd/ -T
dvdauthor -o dvd/ $1.mpeg
dvdauthor -o dvd/ -T

If you want to split the mpeg file into chapters every 15 minutes, we can modify the script into this (my video is only 2 hours duration, so it ends with 2:00:00):

dvdauthor -o dvd/ -T
dvdauthor -o dvd/ -t -c 0:00:00,0:15:00,0:30:00,0:45:00,1:00:00,1:15:00,1:30:00,1:45:00,2:00:00 $1.mpeg
dvdauthor -o dvd/ -T

Here's an example of command i'd issue for my opening.mpeg :

$ ./makedvd.sh opening

Wait a minute ! What if i have several mpeg files and would like to make them into one DVD filesystem ?
Dont worry ! In this case, you should make an XML file like this :


<dvdauthor>
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="myfile1.mpeg"
chapters="0:00:00,0:15:00,0:30:00,0:45:00,1:00:00"
/>
<vob file="myfile2.mpeg"
chapters="0:00:00,0:15:00,0:30:00,0:45:00,1:00:00"
/>
</pgc>
</titles>
</titleset>
</dvdauthor>


And then to make a DVD filesystem based on this XML file with the command :

$ dvdauthor -o dvd -x input.xml

The output of this step is a directory named dvd that contains the DVD filesystem

3. Make a DVD ISO image
Okay, now i have the dvd directory, ready to be made into a burnable DVD ISO image. All i have to do is this :

$ genisoimage -dvd-video -v -o mymovie.iso dvd

The output of this step is a DVD ISO image.

4. Play the DVD ISO image
This step is optional, but i like making sure of things before burning it onto a DVD-R. In this step, i just need to issue this command :

$ mplayer dvd://1 -dvd-device mymovie.iso

If i want to play specific chapters that i've made during step 2, i'd use this command :

$ mplayer dvd://1 -chapter 2 -dvd-device mymovie.iso


5. Burn the DVD ISO image
Okay, you've tested the ISO file and everything is like you wanted. Now you can proceed to burn the DVD ISO image. I use K3b for this. Just fire the application, choose from menu, Tools -> Burn DVD ISO Image

References that help me achieve this :
http://www.lynchconsulting.com.au/blog/index.cfm/2007/12/24/HOWTO-Create-DVDs-on-Ubuntu
http://dvdauthor.sourceforge.net/doc/examples.html
http://radagast.bglug.ca/linux/dvd_authoring/dvd_authoring.html
http://forums.fedoraforum.org/archive/index.php/t-160869.html
http://linux.softpedia.com/get/Multimedia/Video/dvdauthor-8198.shtml

Monday, October 13, 2008

Burning DAT VCD File

I'm in a situation where i need to burn a .DAT file that was copied from a VCD disc.
Looking around inside K3b, and found no tools for that.

After googling around, i found out about the usage of a tool package called vcdgear.
But havent tried that tool, because after reading more at the search results, i found out a very user friendly tool called devede.

Fired up my SuSE YaST -> Softare Management -> search for devede, and installed it successfully !

The proggie is quite user friendly. It can even convert the DAT file to a ready-to-be-burned cue and bin files. So what i did is add a new file, choose the DAT file, and click forward to start the conversion process. After that i'd just burn the output image file using K3b from the Tools menu -> Burn CD Image, and then selecting the cue file.

Creating DVD or CD ISO file

To create a DVD ISO, one can use this command at shell (i'm using bash)
dd if=/dev/dvd of=/mydir/myDVDImage.iso

Or to create a CD ISO, one can use this command
dd if=/dev/cdrom of=/mydir/myCDImage.iso

Or if one prefers a friendly GUI tool, i suggest K3B burning tool. Click on menu Tools -> Copy DVD / Copy CD. And dont forget to check the "Create Image Only" checkbox before start copying the DVD or the CD. Notice the directory too that will hold the output image file in the burn window dialog.