Sunday, February 1, 2009

Running multiple X sessions

* Difficulty: Easy
* Application: X

If you share your Linux box with someone and you are sick of continually logging in and out, you may be relieved to know that this is not really needed. Assuming that your computer starts in graphical mode (runlevel 5), by simultaneously pressing the keys Control+Alt+F1 - you will get a login prompt. Insert your login and password and then execute:

startx -- :1


to get into your graphical environment. To go back to the previous user session, press Ctrl+Alt+F7, while to get yours back press Ctrl+Alt+F8.

You can repeat this trick: the keys F1 to F6 identify six console sessions, while F7 to F12 identify six X sessions. Caveat: although this is true in most cases, different distributions can implement this feature in a different way.

Save ways to exit with system freeze

In Linux, when your entire system freezes, there are plenty of safe ways to exit and get back on track immediately. Alt + SysRq + (a selection of other keys) will do the magic trick. Note: 'SysRq' key is equivalent to the 'Print Screen' key.

Alt + SysR + K
Kill all processes (including X), which are running on the currently active virtual console.

Alt + SysRq + E
Send the TERM signal to all running processes except init, asking them to exit.

Alt + SysRq + I
Send the KILL signal to all running processes except init.

Alt + SysRq + L
Send the KILL signal to all processes, including init.

Alt + SysRq + S
Run an emergency sync (cache write) on all mounted filesystems. This can prevent data loss.

Alt + SysRq + U
Remount all mounted filesystems as read-only. This has the same effect as the sync combination above, but with one important benefit: if the operation is successful, fsck won't have to check all filesystems after a computer hardware reset.

Alt + SysRq + R
Turn off keyboard raw mode. This can be useful when your X session hangs. After issueing this command you may be able to use .

Alt + SysRq + B
Reboot immediately without syncing or unmounting your disks. Using this, you will likely end up with filesystem errors, so this is not highly recommended.

Alt + SysRq + O
Shut the system off right away.

If all these ‘Alt + SysRq’ keyboard combo are hard to remember, you can press Alt + SysRq + H to display a helpful list of the shortcuts above.

http://www.junauza.com/2009/01/linux-keyboard-shortcuts-to-exit-safely.html


Useful comments:
The first thing you should try in something hangs, is just Alt-SysRq-K (or Ctrl-Shift-Backspace while in a graphic X environment, which is a little less brutal). But mostly plain patience will do the trick.

A great way to use these keys is holding down Alt-SysRq while slowly typing REISUB (BUSIER backwards). This will reboot your system in a safe way (just look at the explanations above).

Also note: Alt-SysRq-H only helps you out in the command line.
---------------
If you're having the screenshot (screen capture) try this; it worked for me in Ubuntu:
add this line to the end of /etc/sysctl.conf

kernel.sysrq = 1

then reboot.

For it to work properly, you need to press alt+sysrq simultaneously, then press your exit code (eg k) while holding the other keys down.
-------------
Ctrl+Alt+Esc usually do the thrick for me ;)

Saturday, January 31, 2009

Extract audodio from flash file with ffmpeg

After downloading the video, I ended up with a file named My_Chemical_Romance_-_Famous_Last_Words.flv.

Once you have downloaded the video, just for the sake of interest, lets find out the audio quality of this You Tube audio video.
The ffmpeg documentation does not tell us about a switch which would just output the audio parameters of the input file. After experimenting a little with the ffmpeg tool, it can be found that by just specifying ‘-i’ switch and the input video file, the ffmpeg will output input streams information and quit.

Here is an example of how it looks:

c:\> ffmpeg.exe -i My_Chemical_Romance_-_Famous_Last_Words.flv

Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 24.00 (24/1)
Input #0, flv, from ‘My_Chemical_Romance_-_Famous_Last_Words.flv’:
Duration: 00:04:27.4, start: 0.000000, bitrate: 64 kb/s
Stream #0.0: Audio: mp3, 22050 Hz, mono, 64 kb/s
Stream #0.1: Video: flv, yuv420p, 320×240, 24.00 fps(r)
Must supply at least one output file

From this information (2nd line in bold) we can read that the audio bitrate of a YouTube video is 64kbit/s, sampling rate is 22050Hz, the encoding is mp3, and it’s a mono audio.

You will be surprised how easy it is to extract the audio part as it is in the video. By just typing:

c:\> ffmpeg.exe -i My_Chemical_Romance_-_Famous_Last_Words.flv famous_last_word.mp3

the ffmpeg tool will extract it to an mp3 audio file!

That’s it! After running this command you should have ‘famous_last_words.mp3‘ file in the same folder/directory where the downloaded video file was!

We can go a little further and look up various audio switches on the documentation of ffmpeg. For example, if we had some fancy alarm clock which can be stuffed an mp3, you might not need the whole 64kbit/s of bitrate. You might want to convert the audio to a lower bitrate, say 32kbit/s.

The Section 3.5 - Audio Options of the ffmpeg documentation says:

`-ab bitrate‘ - Set the audio bitrate in bit/s (default = 64k).

So, by specifying a command line switch ‘-ab 32k‘ the audio will be converted to a lower bitrate of 32kbit/s.

Here is the example of running this command:

c:\> ffmpeg.exe -i My_Chemical_Romance_-_Famous_Last_Words.flv -ab 32k famous_last_word.32kbit.mp3
[...]
Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 24.00 (24/1)
Input #0, flv, from 'My_Chemical_Romance_-_Famous_Last_Words.flv':
Duration: 00:04:27.4, start: 0.000000, bitrate: 64 kb/s
Stream #0.0: Audio: mp3, 22050 Hz, mono, 64 kb/s
Stream #0.1: Video: flv, yuv420p, 320x240, 24.00 fps(r)
Output #0, mp3, to ‘famous_last_word.32kbit.mp3′:
Stream #0.0: Audio: mp3, 22050 Hz, mono, 32 kb/s
Stream mapping:
Stream #0.0 -> #0.0
size= 1045kB time=267.6 bitrate= 32.0kbits/s
video:0kB audio:1045kB global headers:0kB muxing overhead 0.000000%

The line in bold indicates that the output audio indeed was at a bitrate of 32kbit/s.

Some other things you can do are - changing the codec of the audio (-acodec option (find all codecs with -formats option)) or cut out a part of the audio (-t and -ss options) you are interested in.

This technique actually involved re-encoding the audio which was already in the movie file. If you read closely the audio option documentation, you will find that the -acodec option says:

`-acodec codec’ - Force audio codec to codec. Use the copy special value to specify that the raw codec data must be copied as is.

If the input video file was from YouTube or it already had mp3 audio stream, then using the following command line, the audio will be extracted much, much faster:

c:\> ffmpeg.exe -i My_Chemical_Romance_-_Famous_Last_Words.flv -acodec copy famous_last_words.mp3

source:http://www.catonmat.net/blog/how-to-extract-audio-tracks-from-youtube-videos/

Wednesday, January 21, 2009

Add Applications to the Startup Programs


Ubuntu:

By adding an application to the Startup Programs, that application will automatically run once Ubuntu has finished booting. This is quite useful for applications such as Gmail Notifier that have a small footprint but provide a useful function to the user.


1. Click System, mouseover Preferences and select Sessions.

2. Under the Startup Programs, click the Add button.

3. Input the Name and the Command that executes the desired application in the appropriate text boxes. If you aren’t sure of the command, click the Browse button and go to the executable. For example, the command you would input for the Gmail Notifier is gmail-notify.

4. Click OK.

5. Click the Close button to exit the Sessions window.

Another way to access iso files

An ISO file is an image of a CD or DVD. You can access the files contained within the ISO (without installing any software or having to burn the image to disc) by mounting the image and unmount the image when you are done with it. Here’s how:


1. Open a terminal window.

2. You will need to create a new directory for your ISO image. Execute the following command in your terminal window:sudo mkdir /media/iso

3. Now execute this command to mount the ISO image:sudo mount -o loop /home/shamanstears/Documents/test.iso

Make sure to change the path in the above command to the path of the desired ISO file.

4. Close the terminal window.

5. Go to the Ubuntu Main Menu.

6. Click Places and select iso.

7. The file browser will open, displaying the contents of the ISO image.

To unmount the file, use this command in a terminal window:sudo umount /media/iso/

source: http://www.tech-recipes.com/rx/2747/ubuntu_how_to_mount_unmount_iso_files/

Friday, January 16, 2009

Working with virtual cdroms

The most handy gui tool for mounting and handling iso's in Ubuntu is gmount-iso (install via Add/RemoveApplications). You can choose the mount too. Limitations to comparable MS software like Alcohol 120 % and UltraIso is the limitations to the kind of images that are recognized so not .nrg (Nero)or clone cd images. To install as a conversion tool in Wine UltraIso is better suited than Alcohol, according to Wine APPdb

Tuesday, January 13, 2009

AcetoneISO, virtual cdrom in Ubuntu

AcetoneISO, you can convert : .bin, .mdf, .nrg , .img , .daa , .cdi , .xbx , .b5i , .bwi , .pdi to .iso and then mount them easily. For more infos, you can check out : http://doc.ubuntu-fr.org/acetoneiso , I know, it's in french, but the commands are still the same. You just need to have before installing : kommander, kdebase-bin, kdelibs4c2a, konsole, konqueror, p7zip and fuseiso. For the ones like me who'd like to mount their isos.

Downloadlink for deb: linkhttp://downloads.sourceforge.net/acetoneiso2/acetoneiso2_2.0.2-20080602_i386.deb?use_mirror=osdn

Blog Archive