Guitars, Paramedics, Linux, and Me

December 12, 2006

Fedora Core 6: Fun With YouTube Video

Filed under: Linux — S. Kindley @ 12:05 am
Tags: ,

I stumbled upon a few links to scripts that accomodate downloading YouTube Video and converting them into .avi or .mpg files. This works on my Fedora Core 6 laptop. If you have followed my Multimedia Support article you will have the tools you need installed.

First let’s grab the python script used to capture YouTube videos and download them to our computer. Just wget to retrieve the script.

Once that is done simply:

python youtube-dl -o test.flv

The script will fetch the video for you and save it as test.flv. Change test.flv to whatever name you want to call the .flv file.

Now mplayer, totem, and VideoLan Client (among others) will play this .flv format as is. But to convert the video to .avi or .mpg we can simply use ffmpeg to do the job.

ffmpeg -i test.flv -aspect 4:3 -r 90 -ab 96 -ar 44100 -b 1800 -s 640×480 -y test.mpeg


ffmpeg -i test.flv -aspect 4:3 -r 90 -ab 96 -ar 44100 -b 1800 -s 640×480 -y test.avi

There are also some bash scripts out there that will download and convert all in one shot.

I personally like to use a simple bash script I’ve customized:


BASEURL=”” ; read -p “YouTube URL? ” ORIGURL ; read -p “Desired path/filename? ” OUTFILE

wget -c -S -O ${OUTFILE}.flv ${BASEURL}`curl -s ${ORIGURL} | grep player2.swf | cut -f2 -d? | cut -f1 -d\”` && ffmpeg -i ${OUTFILE}.flv -aspect 4:3 -r 90 -ab 96 -ar 44100 -b 1800 -s 320×240 ${OUTFILE}.mpg && exit 0

These lines are not supposed to be wrapped if you cut-n-paste!

chmod +x this file and run it like ./youtube

Have fun.


1 Comment »

  1. Hi Scott. I found a nice Firefox extension for my wife (she likes You-Tube) called, no kidding, “Ook? Video Ook!”. It simplifies downloading the videos into a one-click process, and the files are saved as .flv. I then associated .flv files to MPlayer so she could just click them and play, no thinking needed. (She isn’t as enthusiastic about computers as you or I). It works fine with the latest Firefox 2. It doesn’t convert the files, however, so if I need to do so, I’ll be taking another look at your script.

    Comment by symbolik — January 14, 2007 @ 5:13 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: