Monday, February 18, 2008

Install multimedia codecs

There are very important question for newbees - how I can listen my music and watch my videos? As you know Ubuntu install only OGG and FLAC codecs from a box. These are exellent multimedia formats but many users use MP3 and AVI (DivX, Mpeg etc.). And maybe you want to watch your favourite DVD.

Well, that's easy. Go to Programs -> Add/Remove... and check in Sound&Video section these items:

  • GStreamer ffmpeg video plugin
  • GStreamer extra plugins
  • GStreamer plugins for aac, xvid, mpeg2, faad
  • GStreamer plugins for mms, wavpack, quicktime, musepack


Then go to Other section and check:

Ubuntu restricted extras
Macromedia Flash plugin

And then press Apply. Now additional codecs will be installed. After this you will be able listen your music and watch your videos. You also can use ffmpeg for convert video from one format to another, for example from flv to avi.

For watching licensed DVD you can use these commands (for Gutsy):
sudo wget http://www.medibuntu.org/sources.list.d/gutsy.list -O /etc/apt/sources.list.d/medibuntu.list

Add a GPG-key:
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update

Now launch Synaptic, update repositories, search and install these packages:
libdvdcss2
w32codecs


OK, now you can watch DVD. I recommend for this VLC Media Player. On the screenshot you can see a start menu from DVD "Cars" in VLC Media Player.

Mounting ISO images

How I can open my ISO image in Ubuntu? That's very necessary question for newbees. OK, it's very easy in actual fact. All that you need is a standard command mount:

Create any folder, for example /media/isoimage:
sudo mkdir /media/isoimage

Mount .iso file (for example something.iso) in that folder:
sudo mount something.iso /media/isoimage/ -t iso9660 -o loop

For unmount use:
sudo umount /media/isoimage

Yeah, using commands everytime is a difficult for newbees. But Nautilus file-manager has one very good feature - it can use scripts. Now we will write a simple script for mount ISO image with the help of context menu.

1. Create the file mount.sh (click by right mouse button in Nautilus and select Create document -> Empty file, enter the name, double click on it for editing and write text)


#!/bin/bash
# mount
gksudo -k /bin/echo "got r00t?"
BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .iso`
sudo mkdir "/media/$BASENAME"
zenity --info --title "ISO Mounter" --text "$BASENAME e $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
if sudo mount -o loop -t iso9660 $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS "/media/$BASENAME"
then
if zenity --question --title "ISO Mounter" --text "$BASENAME Image already mounted. Open?"
then
nautilus /media/"$BASENAME" --no-desktop
fi
exit 0
else
sudo rmdir "/media/$BASENAME"
zenity --error --title "ISO Mounter" --text "Cannot mount $BASENAME!"
exit 1
fi


2. Open the Properties window for this file and check Allow for execute (unlike Windows Linux recognizes programs not with the help of extention (like .exe for example) but with the help of special attribute eXecute). The other method is command: sudo chmod +x mount.sh

3. Create the file unmount.sh


#!/bin/bash
# unmount
gksudo -k /bin/echo "got r00t?"
BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .iso`
sudo umount "/media/$BASENAME"
sudo rmdir "/media/$BASENAME"
zenity --info --text "Unmounted succesfully /media/$BASENAME"
exit 0


4. As in 2nd item make unmount.sh executable.

5. Open another Nautilus windows, go to home folder, press Ctrl+H for show hidden files and go to .gnome2/nautilus-scripts

6. Copy out two files in that folder (simply drag and drop)

That's all. Now you can simply click right mouse button on the ISO file and select mount.sh in the Scripts submenu. For unmounting - select unmount.sh.

If you want you can use more interesting names for our scripts. For example you can use name "Mpunt ISO" for "mount.sh" script, and "Unmount ISO" for "unmount.sh". Because the first string of both these files is #!/bin/bash, file extention is not some sense, Ubuntu know what it is.

Running the old DOS applications in Ubuntu

Sometimes it is necessary to start the old programs developed for MS-DOS. Maybe someone want to play in old favourite games or other. For such problems we have a Dosbox emulator ( http://dosbox.sourceforge.net/ ).

Installing is very easy:

1. sudo apt-get install dosbox
2. create the folder for our old programs ~\DOS
3. launch the emulator
dosbox
4. create the configuration file in our home folder
config -writeconf dosbox.conf
5. now you can use ~/dosbox.conf file for changing a typical preferences, such as autoexec section. For example, if you want mount ~/DOS folder as drive C in time of Dosbox starting you can use this command: mount c ~/DOS



This screenshot shows a launched QBasic.

Hello and welcome!

Hello! My name is Oleh and i'm from Ukraine. I'm a post-graduate student and a teacher in Poltava National Technical University (Poltava, Ukraine).

Here I will write articles about Ubuntu Linux, Linux software, programming etc. Not for hackers but for newbees. I have already the blog about Ubuntu in ukrainian - http://korkholeh.blogspot.com/. Now you can see an english version.