Sunday, March 28, 2010

How to restore Grub boot loader after installing Windows

This tutorial will explain how to restore Grub after installing Windows 7/Vista/Xp.If you are using dual boot PC with windows,Ubuntu for some reason you reinstall your windows now you may not see your grub 2 is loading because your windows installation might have been over written MBR (Master boot record).
Method 1

Using Ubuntu 9.10 livecd

First you need to download Ubuntu from Ubuntu site

In this tutorial we are assuming the Ubuntu partition is sdc3,and /boot partition is sdc2

Note:- You need to replace sdc3,sdc2 with your partitions.You can check your partition table with fdisk -l

Now Boot up ubuntu from the livecd,open terminal from Applications menu -> Accessories -> Terminal and login as root using the following command

sudo -i

mount /dev/sdc3 /mnt

mount /dev/sdc2 /mnt/boot

grub-install --root-directory=/mnt/ /dev/sdc


If you are not having “grub.cfg” file,use following contents to recreate

mount --bind /proc /mnt/proc

mount --bind /dev /mnt/dev

mount --bind /sys /mnt/sys

chroot /mnt update-grub

umount /mnt/sys

umount /mnt/dev

umount /mnt/proc

exit


Method 2

Using GRUB for DOS

GRUB4DOS is an universal boot loader based on GNU GRUB. It can boot off DOS/LINUX, or via Windows boot manager/syslinux/lilo, or from MBR/CD. It also has builtin BIOS disk emulation, ATAPI CDROM driver, etc.

Download GRUB for DOS

For XP Users

copy the file grldr from grub4dos package to C:\.Edit boot.ini (hidden file) and add this line to the file:

c:\grldr=”grub4dos”


For Windows7/Vista Users

Copy the file grldr,grldr.mbr to C:\.Create boot.ini file in the root directory of C:,copy and paste following into this file.

[boot loader]
timeout=0
default=c:\grldr.mbr
[operating systems]
C:\grldr.mbr=”Grub4Dos”


Now,create menu.lst in root directory,with the following content

timeout 0
default 0
title grub2
find --set-root /boot/grub/core.img
kernel /boot/grub/core.img
boot


Now restart your computer,and select boot from Grub4Dos.Then select boot up Ubuntu in grub menu.
Once login,use this command to install grub into mbr

sudo grub-install /dev/sdc


Note :- Replace sdc with your partiton

Saturday, March 27, 2010

How To Use MEncoder

Install

First, ensure that the mencoder package is installed with all appropriate dependencies with

sudo apt-get install mencoder

You may also consider finding and install the w32codecs package, if you will be working with proprietary formats, such as wmv.

Basic Usage

To use mencoder, you must specify at least an input file, an output file, an audio encoder and a video encoder. As a general framework, you can use the following to convert a video from any type that mplayer can read, to an avi file using mp3 audio encoding.

mencoder -oac mp3lame -ovc lavc -o output_movie.avi

Audio/Video encoders

To see a list of audio encoders supported on your installation, run

mencoder -oac help


To use an audio encoder, specify it as in the example above with -oac .

Similarly for video encoders, search with

mencoder -ovc help

Friday, March 26, 2010

Convert RMVB To AVI Using LINUX Mencoder

In terminal just type this command

mencoder in.rmvb -oac mp3lame -lameopts preset=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200 -ofps 25 -of avi -o out.avi

in.rmvb means input file name
out.avi means output file name..

Hope this will work for you all..Thanks.

Wednesday, March 24, 2010

Riger DB102 Router Mode

Go to http://192.168.1.1.

* Username: tmadmin
* Password: tmadmin

Then you will see this above page. Go and click at the WAN Tab and click at PPP.

Set the new interface as:

* PPP interface = 0
* ATM VC = aal5-0
* Protocol = PPoE
* Use DNS = enable
* Security = PAP

Don’t forget to set your username as USERNAME@streamyx and also your TMNet Streamyx password. When done, click Submit.

Click on ATM VC and make sure interface are set as:

* aal5-0 VPI = 0
* VCI = 35
* MUX = LLC
* Max proto = 2

After that, click on Admin and then Commit and then Reboot Once it’s done you should check your Internet connectivity by loading your favorite website.

If you’re unable to go to 192.168.1.1, please make sure that your PC IP is in the range of 192.168.1.x.

Done!

Sunday, March 21, 2010

PPPoE Setup For Win XP

1.Go to Start, and Click Control Panel

2.In the Control Panel Window, Locate Network Connection and double click it.

3.You should now be in the "network connection" window.

4.In that window on the Left "Network Task" should have two option:

(a)Create a new connection

(b)Set up a home or small office network

Choose (a) Create a new connection

5.The New Connection Wizard will Pop-up
•Click Next

•Choose "connect to the internet" and Next.

•Choose "Set up my connection manually" and Next.

•Choose "Connect using a broadband connection that requires a user name
and password" and Hit Next.

•Type in Streamyx and click Next

•Fill the User name : eg, Streamyxuser@streamyx
Password : xxxxxxxxx
Confirm Password : xxxxxxxx

Leave the All the box checked Unless you have a Firewall Already running
eg. Zone alarm is installed, Be sure to UNCHECK
Turn on the internet Connection Firewall for this connection.
Click Next.

6.Check the Add a shortcut to this connection to my Desktop, and Click Finish

7.Click Connect, and you should be connected in 2 seconds.

How do I connect to Streamyx DSL with Linux?

How do I connect to Streamyx DSL with Linux?

Log in as root Go to a console.

Type 'adsl-setup'

It will do some system checks.

The next question will be for your user name. Type UserID@streamyx Hit 'enter'.

Next it will ask for the interface i.e. your NIC that you are using. Most likely 'eth0'. Unix starts with zero when it comes to assigning device numbers. eth0 is default, so just hit enter.

Next it will ask about 'Demand or Continuously'. Default is 'No'. Hit Enter.

Now it will ask you for your DNS's one at a time.
Type '202.188.1.5' for #1. Hit Enter.
Type '202.188.0.133' for #2. Hit Enter.

Next will be your UserID password.
Type it, hit enter, type it again to confirm, hit enter.

Next will be for firewalling. Press the number zero. Remember when you installed Red Hat, it asked you for high, medium, or low firewall. The firewall in the installation will be good enough. I had some trouble getting numbers 1 and 2 to work correctly in this selection. Maybe just me being a Linux newbie, but zero worked for me.

'Start connection at boot time?' Enter 'yes'.

Now it will show a summary of what you did and will ask you if you want to 'Accept these settings?' Enter 'y' for yes, hit 'Enter'

Next, type 'adsl-start' at the command line.

Now you should be online. Congrats.

Friday, March 19, 2010

How To Convert FLV To 3GP In Ubuntu

If you have a flv video format in your computer and want to convert it to 3gp so you can play this video in your cellphone, you can go to this tutorial step by step:

First you need ffmpeg, but in ubuntu it needs more some libraries to complete it. Try this command in your terminal :

sudo apt-get install ffmpeg

then add this command after it :

sudo aptitude install libavcodec-unstripped-51 libavdevice-unstripped-52 libavformat-unstripped-52 libavutil-unstripped-49 libpostproc-unstripped-51 libswscale-unstripped-0


After this installation complete, then you can use it to convert by this command :

ffmpeg -i fileInput.flv -s 176×144 -vcodec h263 -r 25 -b 200 -ab 64 -acodec mp3 -ac 1 -ar 8000 fileOutput.3gp


Note:-

1. -i means input and -o is output, you can see the configuration of resolution in this file
2. change the fileInput and fileOutput to the name of your target and destination file

Thursday, March 18, 2010

How To Convert .ogv to .avi File After RecordMyDesktop

Simple Method,in terminal type this command

mencoder input.ogv -ovc xvid -oac mp3lame -xvidencopts pass=1 -o output.avi

Note:-
I assume if ogv has no audio just leave out the '-oac mp3lame'

Another Big Poppa Pump Method is,You can do it with mencoder as forum people said.
I personally created a convenient ad-hoc command.
If you convert many files, you may want to do that as well. Do the following

1. create the file with an editor. Type:
gedit /usr/bin/ogv2avi

2. type the commands in the file:
#!/bin/bash
# ogv to avi
# Call this with multiple arguments
# for example : ls *.{ogv,OGV} | xargs ogv2avi
N=$#;
echo "Converting $N files !"
for ((i=0; i<=(N-1); i++))
do
echo "converting" $1
filename=${1%.*}
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o $filename.avi
shift 1

done

3. save the file

4. make the file executable, type:
sudo chmod +x /usr/bin/ogv2avi

5. call the command with the syntax

ogv2avi file1.ogv file2.ogv file3.ogv

you can convert many files in one go !

A simple mencoder command line help
mecoder vob to avi well if you really want to learn how.
You will need to do a 2 pass encode or more either using xvid ,mpeg4 via lavc or x264 for video and libmp3lame for mp3 audio.
I can give you some examples for hq encodes

xvid
Code:

mencoder -oac mp3lame -lameopts cbr:br=128 -ovc xvid -xvidencopts pass=1 -o /dev/null

mencoder -oac mp3lame -lameopts cbr:br=128 -ovc xvid -xvidencopts pass=2:chroma_opt:vhq=4:bvhq=1:quant_type=mpeg:bitrate=900 -ofps 30000/1001 -o

mpeg4
Code:

mencoder -o /dev/null -oac mp3lame -lameopts cbr:br=128 -ovc lavc -ffourcc DX50 -lavcopts vcodec=mpeg4:vbitrate=900:vhq:vpass=1 -ofps 30000/1001 ; mencoder -o -oac mp3lame -lameopts cbr:br=128 -ovc lavc -ffourcc DX50 -lavcopts vcodec=mpeg4:vbitrate=900:vhq:vpass=2 -ofps 30000/1001

X264
Code:

mencoder -ovc x264 -x264encopts pass=1:turbo=1:nr=500:psnr -oac mp3lame -lameopts cbr:br=128 -ofps 30000/1001 -o /dev/null

mencoder -ovc x264 -x264encopts pass=2:nr=500:psnr:bitrate=900 -oac mp3lame -lameopts cbr:br=128 -ofps 30000/1001 -o

Wednesday, March 17, 2010

How to Download iTunes in Linux Ubuntu

As you probably know, iTunes is a software written for Mac and Windows only, and does not work for Linux...or does it?Dont worry nWo Computer Linux are here,to guide you. There IS a way (100% proven and tested effective) to download iTunes on Linux Ubuntu, and here's just how to do it.

Step 1

Download WINE. WINE is a software written for Linux that allows it to run Windows software. You can download WINE through the terminal:

sudo dpkg -i wine_0.9.45~winehq0~ubuntu~7.04-1_i386.deb

Step 2

Next, you need to configure WINE to the options that we need. To do this, simply type in the terminal "winecfg". Follow these instructions:

-Choose the Windows XP option in the Applications tab.
-Select Autodetect in the Drivers tab.
-Check the ALSA Driver and uncheck the OSS Driver in the Audio tab.

Click OK. Your changes will be saved.

Step 3

As far as I know, the latest version of iTunes that can be downloaded on Linux Ubuntu is version 7.2. You can find a download of it here:

http://www.oldapps.com/itunes.php?old_itunes=20

NOTE: IF THIS LINK IS BROKEN BECAUSE OF FUTURE UPDATES, PLEASE LET ME KNOW. I SHALL EDIT THIS POST AND FIND ANOTHER LINK WHERE YOU CAN SUCCESSFULLY DOWNLOAD THIS. THANKS!!

Step 4

Once you have downloaded iTunes 7.2, go to the terminal once again and type

wine iTunesSetup.exe

Step 5

Welcome Screen
This will take you to a Welcome Screen.

Step 6

iTunes License
Accept the license.

Step 7

Installer Options
Select the installer options as seen in the picture.

Step 8

Autorun Popout
A popout will appear, asking for autorun.

CLICK NO!!!!

Step 9

Installing iTunes
The file will download.

Step 10

Click Finish.


Step 11

It took me a couple of gos, but I got it to work in the end. Once iTunes has been successfully installed, run the program using:

wine ~/.wine/drive_c/Program\ Files/iTunes/iTunes.exe

Step 12

And that's it! You now have iTunes installed on Linux Ubuntu. Congratulations!!

Tuesday, March 16, 2010

How to Transfer Music and Video to the iPhone

How could you live without tunes and pictures on your new toy, that cool iPhone? Easy to do, and quick too!

1

You may want to set the iPhone to not sync automatically to iTunes as this could give you too much of an overload of information at once, this way you can pick and choose what you want to put on it. You can also set iTunes to not sync right away with all iPhones since I bet your SO didn't let you get away without getting them one to, so you can do your separate loading with minimal problems!

#
2

To set it up to not sync automatically, Connect it to your computer and in iTunes click the Summary tab. Then un-check "Automatically Sync when this iPhone is connected." This stops iTunes from coming up when you connect iPhone. You can still start a sync manually.
#
Step 3

To Set it up to not sync for all iPhones, In iTunes choose iTunes then Preferences (on a Mac) or Edit then Preferences (on a PC), then un-check "Disable automatic syncing for all iPhones."
If this checkbox is selected, iPhone won't sync automatically, even if "Automatically sync"is selected in the Summary pane.
#
Step 4

OK, now you're ready! Click the Summary tab, then click Sync in the lower-right corner of the window. Or, if you've changed any sync settings, click Apply.
#
Step 5

Now go to the 'Music' pane. You can sync it to grab it all, or select your personal playlists and/or podcasts. It will load up and be ready to go! Anything Audio such as music video's or audiobooks will load here.
#
Step 6

Next go to the 'Video' pane. Same thing, pick and choose or load them all up!
#
Step 7

If you want to carry your photo albums, it is as simple as going to the 'Photo' pane and bringing them over as well. This is when you would need iPhoto 4.0.3 or later on a Mac, or with Adobe Photoshop Album 2.0 or later or Adobe Photoshop Elements 3.0 or later on a PC. If you have them formatted in a folder already that is not needed, just pull them over.
#
Step 8

Enjoy, but try to remember that other people may not like your choice of music (or just not want to listen to any music) and if you NEED to blast it, get good headphones, you can afford it since you can afford this phone, haha!

Friday, March 12, 2010

TURN YOUR UBUNTU TO MAC OSX LEOPARD

apple linuxTutorial how to change your Ubuntu to Mac Os.Please contact me,if you dont know how to do it.(jegarini.gmail.com).

Disclaimer: This tutorial was based on Ubuntu Intrepid and Mac4Lin RC1 themes. I don’t guarantee that it will work on other distro or other version of Ubuntu.


Download the Mac4Lin themes and extract it to your Home folder. You should see a Mac4Lin_v1.0_RC1 folder that contains all the configuration files in your Home directory.


Preparing the installation path



Next, in your Home directory, press Ctrl + H to reveal all the hidden files. Check if any of the three folders .themes, .fonts, .emerald exist. If not, create three folders and name them .themes, .fonts, .emerald. Create another folder within .emerald folder and name it themes.



Installing the Mac4Lin themes


Open a terminal, type in:


cd Mac4Lin_v1.0_RC1

sh Mac4Lin_Install_v1.0_RC.sh


This will install the Gnome themes (window border and icons), change the wallpaper and the panel background.


During the installation process, the installer will ask you for root access in order to install certain components (refer to the image below). Type y to continue.


Mac4Lin installer


After the installation, your desktop should look something like this:



mac4lin initial desktop


Installing the AWN dock


(The AWN dock may/may not work in all machine. If you find that it does not work after following the instructions below, you may want to try out Cairo dock that is less demanding on the machine.)


The AWN dock requires a compositing manager to work. If your system supports Compiz, it will be able to run AWN as well. if not, we have to install the X compositing manager.


Go to System -> Preferences -> Appearance, click on the Visual Effects tab. Click on the Extra radio button. If you see the following image, then your computer does not support Compiz. (If you don’t see the image below, proceed directly to install AWN.)



compiz not supported


You have to install the alternative X composition manager


sudo apt-get install xcompmgr


Add it to your auto-start list. Go to System -> Preferences -> Session. Add the following:


xcompmgr-autostart


Install AWN


The AWN dock is already included in the Intrepid repository, so you can easily install it by clicking this link. Alternatively, you can also type the following command in the terminal:



sudo apt-get install avant-window-navigator


Once the installation is done, go to Preferences -> AWN Manager. On the left pane, click on the Themes. On the right, click Add. Navigate to the Mac4Lin_v1.0_RC1 folder. Open up the AWN folder and select Mac4Lin_AWN_v1.0_RC.tar.gz. Click Open. The AWN theme should be installed now. Check the radio button beside the theme and click Apply. Click Close.



Applying Mac4lin AWN theme


Before we launch the AWN, we need to remove the bottom panel so that there won’t be an overlap. At the bottom panel, right-click the mouse and select Delete This Panel. Activate AWN by going to Applications -> Accessories -> Avant Window Navigator. You should see the AWN loading up in the bottom of the screen. To add applications to the dock, click on the Applications at the top panel and navigate to the particular application you want to add. Drag the application icon to the dock. That’s it. You should see something like the image below:


mac desktop with awn



To start AWN everytime you log in, go to System -> Preferences -> Sessions. Click Add. Fill up the following:


add AWN to startup


Click Add, follow by Close. AWN will now automatically load when you login to your computer.



Installing OSX font


Go to System -> Preferences -> Appearance. Click on the Fonts tab Change the following field to the same as the image below:


Mac4lin font setup


Make sure the Subpixel smoothing (LCDs) button is checked. Click Close.



Installing Global menu


There is a repository for Ubuntu Intrepid that you can add to the sources.list, but it is not the updated version (0.6) and it is buggy. Instead, we will download the latest version (0.7.1) from the code homepage. In the future when the repository is updated to the newer and more stable version, I will update this post again.


For 32-bit machine


Download gnome-globalmenu-0.7.1-1.fc10.i386.rpm to your Home folder from the Globalmenu Google code site.


Note that the file is of rpm format. We need to use alien to convert it to deb format.



In the terminal, type:


sudo apt-get install alien

sudo alien --scripts gnome-globalmenu-0.7.1-1.fc10.i386.rpm


This will create a gnome-globalmenu-0.7.1-1.fc10.i386.deb file in your Home folder. Double-click on the deb file to activate the installer. Click Install Package to install Globalmenu.


install globalmenu


For 64-bit machine


# Uncomment to load the GTK module

export GTK_MODULES=globalmenu-gnome

# Uncomment to tell the GTK module to open a Gtk

# TreeView for all menus in the application you start.


# export GNOMENU_FUN=1

# Uncomment to disable global menu.

# export GNOMENU_DISABLED=1

# Uncomment to print a lot of debugging messages

# export GNOMENU_VERBOSE=1

# Uncomment to save the debugging messages to the given file.

# export GNOMENU_LOG_FILE=/tmp/gnomenu.log

# uncomment to disable the plugin for specific programs.

# export GTK_MENUBAR_NO_MAC="fast-user-switch-applet"



Save the file as .gnomerc in the Home folder.


In your terminal,


gksu gedit /etc/apt/sources.list


Add the following line to the end of the file. Save and close.


deb http://ppa.launchpad.net/globalmenu-team/ubuntu intrepid main


Back in your terminal,


sudo apt-get update


sudo apt-get install gnome2-globalmenu



Now, on the top panel, remove all the icons and menu from the left side of the panel. Right-click on the icon and select “Remove from panel”.


On the right of the top panel, remove the logout icon. Still on the right hand side of the top panel, right click and select ‘Add to panel‘. Scroll down the list and add ‘Search for files‘. This will add the spotlight icon to the panel.


add spotlight search to panel


On the left of the top panel, right click and select ‘Add to panel‘. Scroll down the list and add Main Menu and Global Menu Panel Applet.



add globalmenu to panel


The Globalmenu might not appear or work well after you have added it. Logout and login again and you should see the globalmenu working perfectly on the top panel.


Right click on the globalmenu and select Preferences. Check “Enable Global Menu” and unchecked “Icon”.


globalmenu preferences


globalmenu


The globalmenu is compatible with most of the GTK application. However, some programs, such as Firefox will not work with it.


Creating Dashboard effect



We will use a combination of screenlets and Compiz widget plugin to achieve the dashboard effect.


If you have not installed Screenlets, click here to install.


If you have not installed Compiz Configuration Settings Manager, click here to install.


Alternatively, you can also type the following command in terminal to install:


sudo apt-get install screenlets compizconfig-settings-manager


Go to System->Preferences->CompizConfig Settings Manager. On the Left, click on Desktop. On the right, put a check beside ‘Widget layer




Go to Applications –>Accessories->Screenlets. Activate the widgets that you want to display. Right click on the widget and select ‘Properties’. Go to Options tab and select ‘Treat as widget’. Do this for all the widgets that you have activated.



You can now see your dashboard in action by pressing F9.


Fixing up some small detail


Until now, your desktop should be very close to a Mac desktop, but there are still some small details such as the Gnome icon at the top panel, mouse cursor etc. Let’s fix them up now.



Replace the apple logo


1. Download the apple icon (Right-click and select “save link as”).


2. Go to Places –> Home Folder. Press Ctrl + H to reveal the hidden files.



3. Navigate to /.icons/Mac4Lin_Icons_v1.0_RC/scalable/places. Scroll down to find the images distributor-logo.png, gnome-main-menu.png, main-menu.png and start-here.png. Note that all of them are the same image. Rename them to distributor-logo.png.old, gnome-main-menu.png.old, main-menu.png.old and start-here.png.old respectively.



4. Now, with the apple icon that you have downloaded, make four copies and rename them to distributor-logo.png, gnome-main-menu.png, main-menu.png and start-here.png. Copy and paste all of them to the folder.


5. Logout and login again. The logo at the top panel should change to the apple icon now.


Changing mouse cursor


Go to System –> Preferences –> Appearance. Select Customize. Click on the Pointer tab. Select Mac4Lin_Cursors_v1.0_RC. Click Close.



Configuring usplash screen


Until now, you have done up the interior, it’s time to fix the exterior: usplash screen and grub screen.


Install startupmanager by clicking here or type the following command in the terminal:


sudo apt-get install startupmanager


Go to System -> Administration -> Startup-Manager. Click on the Appearance tab.



startup-manager


Press the Manage bootloader themes button. This will pop up a window allowing you to select the background image for the GRUB.



Click on the Add button and navigate to File System –> Home –> Username –> Mac4Lin_v1.0_RC1 –> GRUB. You should see three files. Refer to the below screenshots on how each file looks like. Pick the one that you like best.




Back to the main window, select the image from the drop down bar. Remember to check the box “Use background image for bootloader menu”.


There is a bug in Ubuntu Intrepid that prevent the user from changing the usplash screen. We have to do a workaround using splashy. Here’s the hack for it:


Remove the default usplash


sudo apt-get autoremove usplash


Download these two files to your desktop:


libsplashy1_0.3.10-1_i386.deb


splashy_0.3.10-1_i386.deb


Double-click the downloaded files to install.


Download the osx-splash splashy theme file to your Home folder.


In your terminal,


sudo splashy_config –i ~/osx-splash.tar.gz

sudo mv /etc/splashy/config.xml /etc/splashy/config.xml.old

sudo cp /etc/splashy/themes/osx-splash/config.xml /etc/splashy/config.xml


Now, we need to edit the GRUB file


gksu gedit /boot/grub/menu.lst


Scroll down till you find the kernel entry. Append the term vga=792 to the end of the kernel line (see screenshot below). Save and close.


edit grub for splashy


That’s it.


Complete Screenshots


Grub screen


Mac4Lin_1.0_GRUB1



Login screen


intrepid osx login screen


Intrepid Mac OSX desktop


ubuntu intrepid mac osx desktop


Intrepid Mac OSX desktop with dashboard effect


Intrepid OSX desktop with dashboard effect


Uninstallation


If you want to change the theme back to the original setting, here is what you need to do:


1. Remove the globalmenu from the top panel


2. Remove all the installed files:



sudo apt-get autoremove splashy libsplashy1 gnome-globalmenu


3. Restore the usplash theme and remove the vga=792 from the GRUB file.


sudo apt-get install usplash


4. Uninstall the Mac4Lin themes


cd Mac4Lin_v1.0_RC

sh Mac4Lin_Uninstall_v1.0_RC.sh


Enjoy!



References: Ubuntu Forum, Splashy, Bauer-Power

Tuesday, March 9, 2010

HOW TO MOUNT USB DEVICE LINUX

USB storage devices have the enormous advantage that for the most part they use a standard set of protocols. Thus, instead of needing individual drivers, as does much computer hardware, a standard driver permits access to the devices, making them very portable and able to easily work on many platforms.

Automounting

Mounting

By default, storage devices that are plugged into the system mount automatically in the /media directory, open a file browser window for each volume and place an icon on your desktop. If you plug in a usb hard disk with many partitions, all of the partitions will automatically mount. This behaviour may not be what you want so you can configure it as shown below.

If the volumes have labels the icons will be named accordingly, otherwise they will be named "disk" and as more volumes are added, you can get "disk-1" and so on.

To change the volume label see RenameUSBDrive.

Configuring Automounting

To enable or disable automount open a terminal and type gconf-editor followed by the [Enter] key.

Browse to /apps/nautilus/preferences/media_automount.

The media_automount key controls whether to automatically mount media. If set to true, then Nautilus will automatically mount media such as user-visible hard disks and removable media on start-up and media insertion.

There is another key /apps/nautilus/preferences/media_automount_open. This controls whether to automatically open a folder for automounted media. This key can also be set in the Nautilus (file manager) window. From the Edit menu in Nautilus select Preferences and then select the Media tab.

If set to true, then Nautilus will automatically open a folder when media is automounted. This only applies to media where no known x-content/* type was detected; for media where a known x-content type is detected, the user configurable action will be taken instead. This can be configured as shown below.

Configuring Program Autostart

To control which programs automatically start when you plug in a device, go to System->Preferences->Removable Drives and Media.

Ubuntu 9.10 (Karmic Koala)

In Ubuntu 9.10 (Karmic Koala) Removable Drives and Media is no longer in the Preferences menu but you can still do this as follows.

This user configurable action for specific media types can be configured in the Nautilus (file manager) window. From the Edit menu in Nautilus select Preferences and then select the Media tab. There you can select what happens when media is inserted. For example we need to turnoff audio CD auto play. CD audio "can do nothing" or "ask what to do" or "open folder".

For more complex scenarios, see UsbDriveDoSomethingHowto.

Unmounting/Ejecting

Before you disconnect the device, don't forget to unmount it. This can be done by right clicking the desktop icon and selecting "Unmount" (or in some cases, "Eject"). In Ubuntu 9.10 (Karmic Koala), in the file manager window you can also click on an "eject" button against the name of the mounted volume.

Automounting (Ubuntu Server)

By default, disk drives do not automount in Ubuntu Server Edition. If you are looking for a lightweight solution that does not depend on HAL/DBUS, you can install "usbmount".

Manually Mounting

Using mount

Get the Information

IconsPage/IconGNOMETerminal.png Sometimes devices don't automount, in which case you should try to manually mount it. First, you must know what device we are dealing with and what filesystem it is formatted with. Most flash drives are FAT16 or FAT32 and most external hard disks are NTFS.

sudo fdisk -l

Find your device in the list, it is probably something like /dev/sdb1. For more information about filesystems, see LinuxFilesystemsExplained.

Create the Mount Point

Now we need to create a mount point for the device, let's say we want to call it "external". You can call it whatever you want, just please don't use spaces in the name or it gets a little more complicated - use an underscore to separate words (like "my_external"). Create the mount point:

sudo mkdir /media/external

Mount the Drive

IconsPage/example.png We can now mount the drive. Let's say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point):

sudo mount -t vfat /dev/sdb1 /media/external -o uid=1000,gid=100,utf8,dmask=027,fmask=137

The options following the "-o" allow your user to have ownership of the drive, and the masks allow for extra security for file system permissions. If you don't use those extra options you may not be able to read and write the drive with your regular username.

Otherwise if the device is formatted with NTFS, run:

sudo mount -t ntfs-3g /dev/sdb1 /media/external

IconsPage/IconNote.png You must have the ntfs-3g driver installed. See MountingWindowsPartitions for more information.

Unmounting the Drive

IconsPage/example.png When you are finished with the device, don't forget to unmount the drive before disconnecting it. Assuming /dev/sdb1 mounted at /media/external, you can either unmount using the device or the mount point:

sudo umount /dev/sdb1

or:

sudo umount /media/external

You cannot unmount from the desktop by right clicking the icon if the drive was manually mounted.

Using pmount

There is a program called pmount available in the repositories which allows unprivileged users to mount drives as if they were using sudo, even without an entry in /etc/fstab. This is perfect for computers that have users without RootSudo access, like public terminals or thin clients.

pmount can be used with the same syntax as mount (but without sudo), or quite simply as follows:

pmount  [ label ] 

Example:

  •  pmount /dev/sdb1 flash_drive
    This will mount the device /dev/sdb1 at /media/flash_drive

If you leave off the label option, it will mount by default at /media/device

To unmount the device, use pumount, like so:

pumount 

Example:

  •  pumount /dev/sdb1

For more help, you can see the man pages for pmount and pumount.

Unmounting Explained

IconsPage/IconHint2.png Before disconnecting devices, you must unmount them first. This is similar to "Safely Remove" in Windows in that the device won't unmount until data is finished being written to the device, or until other programs are finished using it. This applies to all types of storage devices, including flash drives, flash cards, external hard drives, ipods and other media players, and even remote storage like Samba or NFS shares.

Failure to unmount before disconnecting the device can result in loss of data and/or a corrupted file system. There are no exceptions to this rule. Be safe - unmount your drives before disconnecting them!

Other Useful Commands

To see a list of your USB devices (the vendor and device ID's), run:

lsusb

To see all attached storage devices and their partitions, run:

sudo fdisk -l

To see information about currently mounted systems, simply run:

mount

LINUX BACK TRACK SCREEN SHOT

For Installation Please Contact Me jegarini@gmail.com 019-4370045



Monday, March 8, 2010

How to use Mencoder to encode videos

With personal media players (PMP) getting really affordable, consumers are converting their video collection to formats that are supported by their favorite PMP. In my case, I use an iPhone so I convert movies to H.264 or MP4 formats.

There are several tools available to convert videos to other formats and mencoder is just one of them. Personally, I use ffmpeg, also from the same family as mencoder but with a graphical front-end. Anyway, to those who want to convert videos using the CLI,here's useful linux tips for you..

Video conversion with mencoder

Mencoder is part of the MPlayer media player package. While MPlayer can play audio and video files, mencoder converts and manages multimedia files. The application has a ton of graphical user interfaces, but you can use it from the command line to produce video files in almost any format you want. Here's how.

Among the file types mencoder can handle are MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, and FLV. The command syntax is straightforward despite a wealth of options. There's little mencoder can't do when it comes to multimedia conversion.

Here's a simple command that converts an MPG file to AVI format:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc
-ovc and -oac represent the options for the video and audio codecs that mencoder will use. To find out what video codecs are installed on your system, use mencoder -ovc help and mencoder -oac help.

Suppose you need a file with no compression on the audio part and decide to use PCM. You can specify the type of audio codec you want by using the acodec option:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc -lavcopts acodec=pcm

When it comes to MP3 compression, you can also choose a bitrate using abitrate:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc -lavcopts acodec=libmp3lame:abitrate=128

You can use lameopts if you have libmp3lame installed and want to add extra options to the encoding process. You can also create files with variable bit rate audio compression:

mencoder file -o file.avi -ovc lavc -oac mp3lame -lameopts vbr=2:q=3

where q can be any number between 0 and 9.

You can do the same thing with the video part of the file:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc -lavcopts acodec=libmp3lame:abitrate=128 vcodec=xvid

If you don't want to use video compression, try vcodec=copy. With that option, the frames will be copied one by one from the source file.

You can use xvid or divx directly, without going through lavc:

mencoder -ovc xvid -oac mp3lame -o destination.avi source.avi

If you need customized quality, you can add a few options to the XviD compression:

mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=878 -o destination.avi source.avi

The higher the bitrate, the better quality the video file will be. The downside is a larger file size.

Now let's get fancy and make an XviD copy of a DVD using two passes. During the first pass, mencoder analyzes the content of the file; on the second pass mencoder encodes the new file based on the information obtained. By using two passes you can produce a better compressed file, but you'll have to wait a little longer for it, and you'll probably see CPU usage at 90% during the conversion:

mencoder dvd:// -oac mp3lame -ovc xvid -xvidencopts pass=1 -o /dev/null

mencoder dvd:// -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=800 -o xvidfile.avi

You can use whatever bitrate option you want. If you need to squeeze a DVD into a 700MB XviD file, you could use the following command, which forces the file size of the resulting AVI to 700MB.:

mencoder dvd:// -ovc xvid -oac mp3lame -xvidencopts bitrate=-700000 -o file.avi

If you don't like the CPU being used to the max and want to leave resources for launching other applications, use the nice option, which will run the program with the lowest priority when it comes to process scheduling:

nice -n 19 mencoder dvd:// -ovc xvid -oac mp3lame -xvidencopts bitrate=-700000 -o file.avi

Suppose you have a folder full of small video files of different types and would like to merge them into one big movie for easy watching. First, rename them so that they're in the order you want them to appear in the final video, then use:

mencoder * -o output.avi

If you want to add a particular audio file to a movie, use:

mencoder source.avi -o destination.avi -ovc copy -oac mp3lame -audiofile file.wav (for uncompressed files)

mencoder source.avi -o destination.avi -ovc copy -oac copy -audiofile file.mp3 (for compressed files)

To convert a video file to run on a device running iPodLinux, use:

mencoder -ovc raw -ofps 15 -oac pcm -vf scale=176:-2,expand=176:132,format=bgr16 input.file -o output.avi

This produces a RAW AVI file with uncompressed audio data and scales it so it fits the Nano's tiny screen perfectly.

I have a Pocket PC that I sometimes bring with me on business trips. I take a couple of movies I haven't seen in a while and convert them to fit on a 512MB SD card:

mencoder -oac mp3lame -lameopts mode=3:preset=24 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=384:keyint=250 -vop expand="320:240" -o outputfile.avi inputfile.avi

or

mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=200:abitrate=48 -vop scale=320:240 -oac copy -o output.avi

The difference here is that the latter command scales the file and the former fills the PDA's 320x240-pixel screen with the movie.

If you have a webcam and want to record the output, use:

mencoder tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:forceaudio -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:acodec=mp3 -ffourcc divx -o test.avi

The command records anything output by /dev/video0 in 640x480 resolution, using DivX with MP3 audio as an output result.

As you can see, you can use mencoder to convert almost any type of video file in several ways. It works fast, it works well, and I wouldn't change it for any other application, be it GUI-friendly or not.

example pic made by me

Sunday, March 7, 2010

Convert images with open source ImageMagick

Tools like the GIMP (www.gimp.org) and similar graphical applications are great for modifying and manipulating images. Sometimes, however, they can be overkill for little things that need to be done, such as converting file types or resizing images. As well, a graphical tool can be time consuming and difficult to script, unlike CLI tools.

The ImageMagick suite (www.imagemagick.org) of programs allows you to manipulate images from the command-line, making it much simpler to convert large numbers of pictures or even for that single quick image conversion.

Some of the tools that ImageMagick includes are the convert tool, the composite tool, and the display tool.

The convert tool is used to convert pictures from one format or size to another. The easiest method is to simply convert an image from one format to another using:

$ convert image.jpg image.png

This will convert image.jpg from a JPEG to a PNG and save it as image.png. To convert and resize an image, use:

$ convert -size 50x50 image.jpg image.png

This will convert from JPEG to PNG format and resize the resulting image to 50x50 pixels. Likewise, you can use convert to rotate an image:

$ convert -rotate 90 image.jpg image.png

This will rotate the image 90 degrees and convert it to a PNG file. To manipulate the file and keep it in the same format:

$ convert -rotate 90 image.jpg image-new.jpg

To create a composite image, or layer one image above another, use the composite tool. For instance, to put logo.jpg in the top-left corner of image.jpg, you would use:

$ composite -gravity NorthWest logo.jpg image.jpg composite.jpg

This will layer logo.jpg over image.jpg in the top-right corner (NorthWest), and the resulting file will be named composite.jpg. Each edge of the picture is noted by direction: Top is North, bottom is South, right is East, and left is West. The composite tool respects transparent pixels, so using it is a great way to automatically tag all your photos with your name or Web site address.

These commands merely scratch the surface of what ImageMagick can do. ImageMagick is capable of creating new images, embedding steganography in pictures, and much more.

WHY LINUX BETTER THAN WINDOWS