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.

Saturday, July 12, 2008

Tux4Kids !

Just found a bunch of softwares for kids to learn about math, drawing creativity, etc, and best of all, these softwares are free and available for many platforms like windows operating system, linux ,etc.

Here's a screenshot of tux math, and you can download it from the download page.

And here's the homepage for tux paint :-)

Monday, June 23, 2008

The Greatests

The greatest achievement is selflessness.
The greatest worth is self-mastery.
The greatest quality is seeking to serve others.
The greatest precept is continual awareness.
The greatest medicine is the emptiness of everything.
The greatest action is not conforming with the worlds ways.
The greatest magic is transmuting the passions.
The greatest generosity is non-attachment.
The greatest goodness is a peaceful mind.
The greatest patience is humility.
The greatest effort is not concerned with results.
The greatest meditation is a mind that lets go.
The greatest wisdom is seeing through appearances.

Wednesday, June 11, 2008

First Java ME Research

Okay, here's what i've found with our Java ME's demo app to run in my ipaq since my first blog.

At last i've found a suitable JVM for my Java ME purpose. It's Creme JVM from http://www.nsicom.com/. It supports some important features that i seek :
* Memory usage up to 128M. So if you're developing a mobile app which is quite significant in size or data, you should consider buying a pocket pc with bigger user memory (user memory is not to be perceived to be the same as RAM, be careful !) and run it using creme.
* Can run full screen !
* Can activate GPRS connection from cremex extension library
* Supports swing via JSR 209 (AGUI). Creme provides this as extension CAB file that can be installed after the installation of creme jvm in the pocket pc.
* Supports JNI, especially important for native printing

Here are some requirement of the CDC demo app i'm working on :
0. Rich user interface
Creme supports Swing ! No it's not slow, nor that it's fast. It's working just fine to me :)
1. Starts automatically, full screen when the ppc is activated
This is accomplished easily by putting the lnk file to the startup folder in the windows mobile directory
2. The app always stay on top
Creme also provides an extension class that can make it always stay on top.
3. Must be able to sync via WiFi
I just need to use java.net.URL or Apache HttpClient's library to connect to a servlet, fetching or downloading data.
4. Must be able to sync via GPRS with HTTPS with custom generated certificate
To be able to activate GPRS is already provided from from cremex extension library. Creme also got HTTPS support using jsse 1.0.3. One just need to place it in the creme\lib\ext directory. I tried java.net.URL for this HTTPS thing and it works nice, but using the apache httpclient is still problematic. The httpclient seems to be unable to find the SSL implementation.
5. Got embedded database
Apache Derby Rocks ! It supports CDC 1.0 and 1.1 in newer versions !
6. The app cant be closed by the users, only by those admins with the correct passwords. So the menu File -> Exit will prompt for a password. Wrong password takes you back to the app screen. This can be easily achived in Swing.
7. H/W keyboards wont be usable, like the camera button, the windows button that could trigger the start menu activation, etc. Only virtual keyboard will be usable. This is not supported by Creme yet by default, but Creme's support told me that this is going to be easily added if i were to become their customer, he he ..
8. Being able to print transactions on the field. We use Datecs PP-55 thermal printer for this necessity. The people from Datecs is kind enough to give me a sample of CPP source for text printing, and i use JNI calls for that. Works like magic.

Find out how to combine netbeans mobility pack with creme vm here. You should find this helpful as netbeans provides you some easiness like :
- It's an Java IDE, so you get all the quick fix, auto completion, refactoring, etc.
- Make one jar that consists of your classes and all the third party jars needed to run your program to be copied later to pocket pc.
- It has a GUI Builder that is suitable to design swing screens. To use the GUI Builder really helps you develop patience .. haha, but still a blessing than coding it manually.

I'll keep posting for updates.