Sunday, August 7, 2011

Commandline Compression and Decompression

There are various compression formats, of which the mostly used under GNU/Linux are gzip and bzip2.

Compression:
tar.gz
To use gzip to create .gz package, you need to first create a container. For that tar can be used. Packaging files into a container and compression are two different things. gzip is mainly used for compression of a single file, which can be a container made from tar as well.
tar -cvf filename.tar dir-or-file
gzip filename.tar

tgz
Its same as tar.gz done using tar
tar -czvf filename.tgz file-or-dir

tar.bz2
tar -cvf filename.tar file-or-folder
bzip2 filename.tar
#OR
tar -cvjf filename.tar.bz2 file-or-folder
Both gzip and bzip2 will delete the source file after compression.

Decompression (expand):
tar.gz or tgz
tar -zxvf filename.tar.gz   #or filename.tgz

tar.bz2
tar -xvjf filename.tar.bz2

Saturday, August 6, 2011

Install Restricted Multimedia Codecs in Ubuntu

Some codecs like libdvdcss2 are restricted due to its proprietary nature. They are required to play dvds. To install them in Ubuntu, you can add the medibuntu repository and do an apt-get.
1. Add the repository
sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get -q update
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring
sudo apt-get -q update
sudo apt-get --yes install app-install-data-medibuntu apport-hooks-medibuntu
2. Install the necessary codecs:
sudo apt-get install w64codecs libdvdcss2
You can install w32codecs as well.
3. Done.

Also you can install the mplayer essential codecs package
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2  #download the codecs
tar -xvjf all-20110131.tar.bz2 #decompress (expand)
sudo mkdir -p /usr/lib/win32 #make win32 directory under /usr/lib
cp -R all-20110131/* /usr/lib/win32 #copy the contents to it

Add and Remove PPA in Ubuntu

With newer versions of Ubuntu (>= 9.10) you can add PPA (Personal Package Archives), a convenient way to get latest versions of software.
To add a ppa:
sudo add-apt-repository ppa:<repository-name>/<sub-directory>
eg:
sudo add-apt-repository ppa:ubuntu-wine/ppa
You need to have 'python-software-properties' installed. Usually its installed by default. But it's the dependency, just-in-case.

Remove PPA:
1. Install ppa-purge and purge the ppa repository as shown below:
sudo apt-get install ppa-purge
sudo ppa-purge ppa:<repository-name>/<sub-directory>
eg: ppa-purge ppa:ubuntu-wine/ppa

Adding repository or software channel:
1. First backup the sources.list
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
2. Append the repository links (deb,deb-src) to
/etc/apt/sources.list
eg:
deb http://in.archive.ubuntu.com/ubuntu/ natty main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ natty main restricted

Play RealVideo in Ubuntu

To play videos, .rm and other realvideo formats in Ubuntu, the only way that seems to work is to install RealPlayer under Wine.
I have tried custom build of mplayer, w32codecs, kaffeine etc. None of them works. Also the realplayer for GNU/Linux. It loads the video, displays the first frame, crashes and quits just like that.
And to convert them, using mencoder fails giving the error "Video Stream is mandatory!".
The command I used to convert is given below:
mencoder in.rm -oac mp3lame -lameopts preset=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200 -ofps 25 -of avi -o out.avi

The ultimate saviour is using realplayer under wine.

1. Install the latest version of wine (previous post).
2. Now download RealPlayer Gold.
3. Install it. Just open it with wine and continue the installation steps.
4. Done.

Now you can play realmedia files like .rm!

Install Wine in Ubuntu

To install the latest version of wine (1.3) under Ubuntu (11.04), open the terminal and give the commands as shown below:
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.3