Skip to main content

Downloading and Converting YouTube Videos for Mobile Phones

Viewing, Downloading, Converting YouTube Video Files

Youtube is one the popular social networking website , but unlike Google Videos which include link for downloading videos Youtube provides no such link here in this article we try to look at ways of downloading videos on to hard disk , Playing them and converting them to a format suitable for them to be played on Mobile Phones . All these would be done underLinux.

Tools needed : -
For converting video from FLV format to 3GP (To be used to be played on mobile phones) following tools are needed : -
1. MPlayer (with all associated libraries installed)
2. FFmpeg source code
3. Active Internet Connection

Downloading Videos from YouTube

There are number of ways of downloading videos form youtube

1. Youtube-dl script : -
There is a handy python script called youtube-dl that can download videos from the youtube website and works as a Linux console application . The script can be found here : -

First you need to note/copy the address of the youtube clip you want to save then supply the address to youtube-dl program which downloads the clip.

use : youtube-dl -o filename.flv "Entire path to youtube clip(ex:- ) where foobar would be actual code of the clip"

If the file needs a user-name and password as it is classified under mature section then following command can be used for downloading the video clip.

use : youtube-dl -u username -p password "Entire path to youtube clip(ex:- ) where foobar would be actual code of the clip" -o filename.flv

2. Using FireFox extension : -

First one hast to install GreaseMonkey on FireFox which enables custom java scripts to run under FireFox browser. Greasemonkey can be found here in this location : -
On clicking the install button the GreaseMonkey install itself on the firefox browser , and the GreaseMonkey can be used after restarting the Mozilla FireFox browser .
A Dialog showing installation of the Script

After restarting the Mozilla FireFox browser type the following address in the address-bar , "" , on typing the address the script install automatically. Now whenever anyYouTube video is loaded in the browser a link with red background is provided at top of web browser allowing for downloading of the file . After downloading the file rename the file as filename.flv where filename is name of file that you want to have.

A Windows showing a red bar at top providing link
for downloading of Youtube Videos

3.Use Third Party websites allowing download of youtube videos

There are website which allows saving of youtube videos to computer ,first go to the page of the clip you want to download , copy the address of the clip then go to paste the link , click on the link and download the file. Rename the downloaded file to file's name.flv
Here are some of the Websites : -


FLV file can be played on the Linux operating system using the MPlayer video player or VLC Video player .
Both can be found here : -

MPlayer : -
VLC Player : -

use : mplayer filename.flv at the console for playing the flv file .

If you dont know about MPlayer or VLC Player better look at this post : -


3gp is a common media format used on mobile phones allowing playback of video . 3gp video is encoded in H.263 or H.264 and audio is encoded in AMR-NB or AAC format . So FLV file has to be converted to these video encoding

mencoder is a good tool for converting one media file format to another , it can convert any media supported by MPlayer from one format to other . It can be downloaded with MPlayer and can be used for encoding the video and audio encoding from FLV to AVI. So that video could be played on mobile phones.

Here are the steps for converting FLV file to 3gp FILE : -

1. First we will extract video from the FLV file and save it as a AVI file which would be combined with audio stream using FFmpeg program .

mencoder Filename.flv -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vop expand=176:144,scale=176:-2 -o temp.avi -ofps 15

Here in the above command Filename.flv is the name of the video file you want to convert to mobile phone format and temp.avi would be the file in which the converted video would be written. 176:144 Is the size of mobile screen of the phone to which we want to resize the video clip. -ofps 15 specifies the frame rate per second.

Now we extract a audio stream from the FLV movie and store it in a external wav file soundump.wav

mplayer -vo null -ao pcm -af resample=8000,volume=+4db:sc filename.flv

This extracts the audio from the file filename.flv and resamples the sound to 8 kHz It also applies a soft clip filter. The result is a file called audiodump.wav that contains the sound. We need to extract sound as 8Khz since FFmpeg wont encode our file if it is higher.

Now a major problem (maybe some legal issue because of proprietary media format) is that because of some reasons the FFmpeg binary that comes dosent include the files to handle the AMR file that is used by 3gp files for storing audio , hence we need to recompile the FFmpeg library to include support for the AMR file.

So first download FFmpeg source-code from Source Code can be obtained from this website : - . Extract the source-code to a suitable directory and go to that directory and chdir to doc here you would find a .texi file FFmpeg-doc open that file in text editor or convert the texi file to dvi using tex program and search for AMR you would find a section like this :-

Section of texi file ffmpeg-doc.texi

@item For AMR WB floating-point download TS26.204 V5.1.0 from
and extract the source to @file{libavcodec/amrwb_float/}.

@item For AMR NB floating-point download TS26.104 REL-5 V5.1.0 from
and extract the source to @file{libavcodec/amr_float/}.
If you try this on Alpha, you may need to change @code{Word32} to
@code{int} in @file{amr/typedef.h}.

@item For AMR NB fixed-point download TS26.073 REL-5 V5.1.0 from
and extract the source to @file{libavcodec/amr}.
You must also add @code{-DMMS_IO} and remove @code{-pedantic-errors}
to/from @code{CFLAGS} in @file{libavcodec/amr/makefile}, i.e.
``@code{CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO}''.

Here copy the address for AMR NB loating point download the file extract it in a temporary directory . Create a directory ffmpegsourcecode-directory/libavcodec/amr_float and extract the zip file contained in it in the newly created directory ffmpegsourcecode-direcotry/libavcodec/amr_float .

Now go to the main directory where the FFmpeg source code is extracted and execute configure script with --enable-amr_nb argument. Example "./configure --enable-amr_nb "

Now make to compile the source code

and make install to install the compiled files.

Now if everything went fine in above steps . FFmpeg should be configured to encode 3gp files properly, now we combine the two pieces to create a one 3gp file using FFmpeg

ffmpeg -i temp.avi -i audiodump.wav -b 48 -ac 1 -ab 12 -map 0.0 -map 1.0 filename.flv

After this command the flv file should be ready to be transferred to a mobile device , and should work fine on any phone capable of playing the 3gp format.

Article Written by Ambuj Varshney <> for Linux On Desktop (
(C) 2006 , Ambuj Varshney


  1. Great blog congratulations!come visit our site and see amazing free on line movies

  2. Thanks for the nice post!

  3. cyberninja2:02 PM does that for you without a software, one of the best sites i have ever seen. Just enter the url and you can download and save the movie in any format you like. I have downloaded tons of music for my ipod. mp4, mp3, avi, flv, wma, aac supported. Nice!

  4. Anonymous3:36 PM

    The Firefox JS plugin does not work with Youtube. Perhaps earlier, but....


Post a Comment

Popular posts from this blog

13 Things to do immediately after installing Ubuntu

In this article i describe some of the things to do immediately after installing ubuntu on your machine . Since most of the people reading this would be shifting from Windows to Linux with a system dual booting so i would focus more on making transition easy from Windows to Linux.

Creating Your ultimate Ubuntu 7.10 Desktop

Ubuntu 7.10 Codenamed Gusty Gibbon was released few weeks back with much fanfare ,now Ubuntu for past couple of years has been one of the most popular Desktop Linux distributions . Ubuntu 7.10 includes a number of features , applets and Wizards to simplify desktop Linux experience however because of many licensing restrictions it does not include out of the box support for popular audio/video codecs and many commercial but good applications . Also because of the limitation of trying to accommodate all kind of applications on single CD Ubuntu comes with a limited set of applications .

Now , i often have arguments with my friends who are new to computers that windows is…

Over 16 Small Games For Ubuntu Linux

Over 16 Small Games For Ubuntu Linux

Ubuntu Linux is one of the most popular Linux distribution , it is especially popular among Linux newbies and windows refuges . Now Ubuntu Linux does come with a descent set of applications , still there is a scope for including some more quality applications and especially games . Now in this tutorial i will show you how to install a large number of small , easy and less resource hungry games on Ubuntu Linux with screen-shots of games .

1. Rocks 'n' Diamonds

Rocks 'n' Diamonds is a Boulderd*sh game for X11 with more than just the falling rocks and diamonds of its namesake. The object is still to collect all the diamonds (and emeralds), then get to the exit before time runs out. But your character must make use of bombs, spaceships, and many other elements in order to fill his quota of jewels.

Installation : -

Type the following command in the terminal window


35 Cool Applications to install on Ubuntu 7.04

35 Cool Applications to install on Ubuntu 7.04
(Important : This Tutorial is For Ubuntu 7.04 To Read the Updated Article for Ubuntu 7.10 Read the Following Articles :

Cool Desktop Linux Applications(Part 1) : Internet and networking applications

Cool Desktop Applications(Part 2) : 25 Small and Simple Games for your Linux/Ubuntu Desktop

Ubuntu 7.04 is undoubtedly one of the most popular Linux distribution especially for Linux newbies , now overall it is extremely usable and good but a very limited number of applications are by default shipped with Ubuntu 7.04 . Now here in this article we look at a number of really good applications that are not shipped by default with Ubuntu as well as instructions on installing them : -

Installing/Enabling additional Repositories
Now many applications need additional repositories to be installed or some to be enabled in Synaptic package manager so before trying out steps given below ensure that repositories in order.

launch Synaptic Package Manager (Syst…