Archive for January, 2010
Extract Audio (.mp3) from Video Files Like .flv, .mov, .avi and Others with Ubuntu
It is very easy to extract the audio track from video files using Linux. All you need is ffmpeg and some codecs.
Let’s get started…
Note: The commands below are for Ubuntu (or Debian derivatives) but you can do the same with any other Linux distribution provided you can install the necessary packages.
1. Add the Medibuntu’s repository to your sources.list:
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
2. Install ffmpeg:
sudo apt-get install ffmpeg
3. Let’s get the restricted packages and some codecs installed:
sudo apt-get install ubuntu-restricted-extras libmp3lame0 libdvdcss2 w32codecs
The above command is for i386 architecture. If you have an amd64 architecture, substitute w32codecs with w64codecs.
Note: This is not a complete list of codec packages by any stretch of the imagination. It will get you started though and you will be able to do most formats, but you might have to add codecs as you go along.
4. Now we are ready to extract the audio from the video files:
ffmpeg -i input_file.flv output_file.mp3
The above command will extract the audio from a Flash video file. You can do the same for a QuickTime file as well:
ffmpeg -i input_file.mov output_file.mp3
Or for an Audio Video Interface file:
ffmpeg -i input_file.avi output_file.mp3
YouTube and other video web sites:
Having done all this, now we can download flash files from places like YouTube and strip the audio from them. All you need besides the steps above is a way to save the Flash files (.flv) from YouTube. An easy way to do that is by using Firefox Add-ons like Download Flash and Video or Flash Video Downloader.
The quality of the audio in the YouTube videos for example is 64 bit/sec. Most of the mp3 files are normally compressed to 128 bit/sec or above. Obviously the quality will not be the same, but a human year cannot tell the difference.
The quality of the extracted mp3 will depend on the quality of the audio track in the video file. So the above statement about the 64 bit/sec audio is mostly the case for the files on some video sharing sites.
How to Resume Partial File Transfers
I work primarily with UNIX and Linux machines and scp is my main choice to transfer files with. It is both convenient, short and secure.
Example:
scp localfile user@remotecomputer:/path/to/target/dir
Recently I was transferring an 8GB file and due to a network issue, the transfer was interrupted at nearly 40%.
I found a solution at joen.dk ,which uses rsync to resume the transfer:
rsync --partial --progress --rsh=ssh host:remote_file local_file
Now we can improve this slightly by shortening the above command. We can substitute –rsh=ssh with -e ssh, and use -P instead of –partial –progress. Also, you can add user@host if you need to specify a different remote shell user:
rsync -P -e ssh user@host:remote_file local_file
This above example will work with any file that was partially transfered. How the transfer was started does not really matter. It could be through scp, nc or even ftp. After you execute the above command it will take rsync a little time to verify the previously downloaded part before it continues with the rest. Be patient, depending on your network speed rsync could take some time to go through what you have already transfered. Of course this is much faster than if you were to start the download all over again and it shows you the progress in percentages.
Keep in mind that there have to be a couple of requirements in place in order to resume the file transfer with rsync:
1. You should have remote shell access.
2. The remote machine should have rsync installed. Since rsync is by default on most Linux distributions that generally should not be an issue.
Search
Archive
Recent Comments
- zjhlogo on How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
- dimitar on Quickly remove special characters from file names
- John on Quickly remove special characters from file names
- John on Quickly remove special characters from file names
- Alin on Quickly remove special characters from file names