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