How to download & save streaming video from the internet, using Linux



The information in this post will help you download and save video files that are hosted on sites like Youtube, Supernovatube, Youku, Megavideo, and linked to by sites like, and It is a good idea to read the entire post before using any of these methods, as host sites have changed from time to time, and so have the methods you can use to download the streaming video files.

Seen the latest cool video on Youtube?  Want to save it on your hard drive so you can watch it again at your leisure or share it with your internetless friends?  Well, it’s simple – if you use Linux.  Everything I explain in this post was done on a computer running Ubuntu 8.10, but I think it will work with any distro.

Okay, let’s start with Youtube videos.  First, watch the video.  Then, before you navigate away from that web page, go and look in your system’s /tmp directory.  You should find a flash video file, named something like Flashbt0cVD.  That’s the file you want.  So move it to your home directory (or wherever you keep your videos) and rename it something more descriptive.

This trick will also work with the movie and TV videos  files streaming over the internet via sites like,, and

There is a problem.  One or two of the video links sites (like delete temporary files when they have finished playing.  This means you can’t move the file out of /tmp after you’ve watched it.  The solution is to link the temporary file to one in your home directory before the temporary file is deleted.  So you start to play the video, then go look in the /tmp directory. You’ll find a randomly-named video file there.  You need to link it to your home directory.  Do this by running this command in terminal:

ln /tmp/Flashuh4G6s ~/video.flv

Now you have got the video file in your /home.  You have to make sure that the name you give to the new linked file does not already exist in the directory.  So in the example above, you would first check that there is no file called video.flv in your home directory.

But there’s another problem.  If you watch a video via the links sites that is hosted at Youku, the video will be delivered as a series of small files (12-13 MB each).  But this isn’t a serious problem.  When they’ve downloaded you can put the randomly-named files into the correct viewing order by checking the properties of the files, looking at the time when the files were created.

If you have any queries, feel free to leave Comments.

UPDATE: If you are a Windoze user and you want to learn how to save streamed media, you should check out this site. There you’ll find info on how to capture and save video from lots of websites, plus audio files from and other internet radio stations. I only use Linux, so I can’t verify the accuracy of the info. But it looks good.

Here’s info about a couple more tools for downloading video from the web. One for grabbing BBC TV (and radio) content, and one for those Youtube videos we all know and love.

For some time now, users of any operating system have been able to watch BBC TV shows streamed over the internet by BBC iPlayer. But if you wanted to download programmes, you used Windows or you were shit out of luck.

Now, Linux users can download BBC content via the new iPlayer Desktop application. But I don’t like it. The content is crawling with DRM. And the player doesn’t work properly on my EEE PC. It might work okay on a better-specified computer. But iPlayer Desktop is compatible with just Intrepid and Jaunty and my desktop machine runs Hardy (I’m talking Ubuntu here – the app works on other distros too). Anyway, I don’t like the app so I’m not supplying a link to it. It’s my blog so blah! If you really want to try it for yourself, check out the “Labs” link on the iPlayer web page.

Anyway, if you want to download BBC TV and radio shows and you use Linux, there is an easy solution – get_iplayer.
This is how it works: Steve Jobs was desperate to sell his crappy iPhones in the UK. So he turned on his diabolical charm and convinced the BBC to offer iPlayer downloads to iPhones. This happened many moons ago, when only Windows OSes could download the content. But some dastardly fellow created a program that pretended to be an iPhone. Oh, and get this: the DRM that infects all the content downloaded from iPlayer is absent from the .mov files sent to iPhones and consequently computers running get_iplayer. It’s a command-line utility, which might put some people off. But as far as I’m concerned there isn’t much wrong with command-line utilities in Linux. So check it out!

The other video download solution I want to present here is the excellent The way this site works is simple. When you search for or go to watch a video on Youtube, you get an URL something like:
To download this video, you type that URL into your browser’s address bar, then add the letters “pwn” like this:
Go to that URL and you will find download links for the video in question. You can download the file in .flv flash format, and most are also available in mp4.

If you have an unreliable internet connection, you can marry pwnyoutube with wget to great effect. Let’s say you want a video of The Clash playing London Calling live. A search of Youtube may turn up this video URL:
So, you run the edited URL in your browser:
This brings you to a web page offering 2 download links. You want the “high quality” mp4 version. But your network connection is lousy. If you set the browser to download this file, chances are the connection will drop before the download completes. But this is no problem. Just right-click on the download link and select “Copy Link Location”. Now open a terminal and paste the download url into the following command:
wget -c
Wget will download the file, and the -c flag means that if the connection is broken, you can run the same command when the link is resumed and wget will start the download where it left off.

Hope this helps.

UPDATE OF THE UPDATE: OMG they have ruined PWNYoutube!!! 😦

Back when I first wrote the review of PWNYoutube, it was simple, and great in its simplicity: you found the video’s URL, you added “pwn” to the URL, browsed to that URL… and you were given a couple of download links. I liked to right-click the link, copy it, then paste it into a wget command in the terminal. Brilliant, right?

But now, you do all that adding “pwn” to the URL stuff… but when you go to that URL, instead of getting a couple of simple download links, you are confronted with a bunch of complicated ridiculousness. “Use one of: SaveVid | YouDDL | ClipNabber | KeepVid…” etc etc etc. No simple download link. No simple wget. Just a bunch of downloading utilities/services/whatevers that I know nothing about, and which I want to know nothing about. Ruined, man. Ruuuiiinneddd!!!

I cast my weary eye over the options, and finally decided to try the bookmarklet. Dunno why, I guess maybe it sounded simple, or maybe unthreatening in its diminuitiveness. I successfully downloaded an mp4 (high quality) image file by using the bookmarklet – what you do is browse to a webpage that includes a Youtube video (it doesn’t have to be a web page actually on – many bloggers and webmasters have Youtube videos embedded in their own sites) and click on the bookmarklet. The resulting mp4 file played well in vlc, so I’ve got no issues in that regard. But changing the PWNYoutube interface so you no longer get a simple download link – that’s just bad. Shame on you, PWNYoutube!.

PWNYoutube – new interface. Boo!!

So, what’s the new PWNYoutube like? Well the bookmarklet works; I don’t know about the other utilities, if I get round to trying them I will post my verdict here. And I really should make an effort to try it all out. That’s what this blog post is all about, after all. But I’m so pissed off with PWNYoutube at the moment, I just don’t feel like doing it. If PWNYoutube can’t be bothered to provide me with a simple download link that works with wget, maybe I can’t be bothered to give them publicity. Fancy shmancy download utilities just don’t do it for me. I like wget. But PWNYoutube don’t like wget. Which makes it feel like PWNYoutube don’t like me.


Here’s a couple more things relating to online video. First of all, some of the sites I have mentioned previously have become pretty crappy. is terrible nowadays.  All it seems to offer are links to buy videos from Amazon or watch videos streamed from Megavideo – and if you don’t sign up to become a member of Megavideo, you can’t watch anything longer than about 56 minutes.

But it’s not all bad news.  It has become easier to download videos from, and these downloaded files are in mp4 format and much better quality than the streamed flash videos.  To download these files, you need to use Firefox, and the Firefox add-on Video DownloadHelper.  When you’ve installed Firefox and the add-on, go to and navigate the site to watch the video you want.  When you click on “Play”, you’ll see the DownloadHelper icon change colour and start moving.  Click on the icon and you’ll get a drop-down menu with a number of options.  Choose to download the file.  Once the download has started, close the tab which contains the playing video: the download speed will increase considerably, and you won’t need the crappy flash version.

That’s all for now; but I’ll update this post as and when new video downloading methods come to light.

6 JUNE 2012: ANOTHER BLOODY UPDATE – but its not really a bad update:

The stuff I told you about at the start of this post, about grabbing video files out of the tmp directory, does not appear to work anymore.  Grr!  BUT:  If  you are using Firefox and have the DownloadHelper add-on, go to Project Free TV and select the TV show/movie you wanna save.  Start watching it; when it’s started properly, the DownloadHelper icon will become all colourful and rotating.  Click on that, and select Copy URL.  Now, go to a terminal and type in something like wget -c -O movie.flv then, before hitting Enter, right-click and select Paste.  That will paste in the actual URL of the movie you want.  Hit Enter, and wget will start downloading the movie.flv file (or whatever name you chose) to your Home directory. Note: in that wget command, the -O is a capital letter O, not a zero.  This seems to work with all the sites Project Free TV link with.  Dunno how long the trick will last, so get going while the going’s good!  Oh yeah, one you’ve got wget downloading the file, close the Firefox tab that’s playing the movie.  Otherwise the download will take much longer.  Good luck!!


ha ha bonk!!


Linux tutorial #56: sudo

To help you get your head round the command “sudo”, there’s an excellent example of its usage below:

The cartoon is from the webcomic  For your homework assignment go check it out!  The cartoon on the front page today (26 Aug) is funny too.  If you don’t get it, google “2 girls 1 cup”… or is it “1 cup 2 girls”?  Whatever, once you’ve seen it you’ll wish you hadn’t!

Linux Tutorial: How to create a password-protected folder



When I first wrote this post, I recommended the use of cfs.  But that was a few years ago, and now I recommend truecrypt.  cfs is fiddly, and is hard to get used to if you don’t use the command line interface much and don’t know how to RTFM.  Whereas truecrypt has a nice graphic user interface, encrypts “on the fly”, and has a ton of other features that make it my fave encryption application.  You can read all about it, and download it, at

Ubuntu does not, by default, provide a way to create password-protected directories.  A right-click on a folder does offer to encrypt, but that is done with gpg, which uses a gpg key.  You’d need to email your public key to anyone you wanted to have access to the folder, which is a rather cumbersome procedure when all you want is a simple password protection!

Using the -c flag with gpg (gpg -c) uses symmetrical encryption –  this means a protected file can be opened with a password.  But gpg -c works only on files, not directories.

Truecrypt is an encryption package that does allow the user to create password-protected directories.  Unfortunately, you can’t install truecrypt with apt-get or Synaptic – it is not in any of the repsitories.  But you can get it in .deb form, from

There is an app in the repositories that enables the user to create password-protected folders.  This app, cfs, is for creating encrypted partitions and filesystems.  And as a directory is a filesystem, cfs is good for our purpose.

cfs is a command-line utility.  Unfortunately, many newbies don’t like using the command-line interface.  But there’s no need to fear the CLI.  Here is a step-by-step tutorial on how to use cfs to create a password-protected directory.

First thing  we need to do is install cfs.  This can be done through Synaptic or with apt-get.  And as are going to be using a terminal for this procedure, we may as well start right now. So, open a terminal Applications > Accesories > Terminal and type in the command

sudo apt-get install cfs

Type in your password when prompted.  apt-get will ask if you want to install the other packages that cfs depends on – answer “y” to all this.  When cfs has been successfully installed, apt-get will exit and you’ll be returned to the command prompt.

There will now be several new commands available to you.  The ones we will need today are cmkdir, cattach and cdetach.

Now we need to create the encrypted directory. To do this, we will use the command cmkdir.  cfs will ask for a “key” – this is the pass phrase you will use to open the folder in the future, and must be at least 16 character long.  In this example I’m going to call my encrypted directory “lock”.

So, go to the location where you want to put the directory and create it,

user@ubuntu:~$ cmkdir lock

So, the encrypted directory “lock” has been created in my home directory – ie ~/lock.  Now we want to put our secret files into it. This is done by attaching another directory to ~/lock. I’ll call this one “clock”, but you can call it whatever you like. cfs will ask for the key – this means the pass phrase you just made up.

user@ubuntu:~$ cattach lock clock

If you look in the directory /crypt you will find the directory you just made – /crypt/clock.  This is where you want to put your secret files. You don’t put the files direcly into ~/lock.

user@ubuntu:~$ mv file1 file2 file3 /crypt/clock/

Now, to close ~/lock so no one can get into it, we need to unattach the directory with the cdetach command.

user@ubuntu:~$ cdetach clock

Do you want to check that your files are in ~/lock, and that they’re encrypted?  Well, let’s see a list of ~/lock’s contents:

user@ubuntu:~$ ls lock
19929910f65ed51c  1deec15b5201f48d  c8b70c7c5b4e5884


So the file names have been encrypted too.  And what’s in them?

user@ubuntu:~$ cat lock/19929910f65ed51c
”’8L„åD3&O0”Ç›5┌¦·1Þ_-R⎽û°8(Ôµ┬çH¸SȾ°␉⎽«¦S£ò?ÿßë´æ‘¡⎺V◆O├ä„E◆ì$VEM¨⎺†VüÔОÄ²ïÑ├] >(␤ ª@Õ呵┘¡•┬/‰éâ┌␌O±“Àâ0Q
H◆?7¿C€#┘èÄSܵ€*?ŠÚB─šKõ‹·ù¾ˆ°ÃB£Êß9ÏU¢ȁ֌+(ëöQ®┐?:≥ÔI•D¡(‹ÚÁ;¿<(ÒÃ⎼ñC…•óI┌ÚMËÕ│S¾ÛüM®ŒÄÇ œÎ␋⎽Ñ◆┬’?    à‹Ì¢ý┌‹€SÉ└½€[¢‰⎼ˆ°ÿ ␌ºä┬üLÈW–ìHÖ¬◆Ô3à° ┌ϛ┼≠␋¶≠­/S-;·
ïŸ20áµïÍ£©≥ŒÔ␌␋—,┐š ├5´Ë²Â␌ß³≠¥–(¢]    ⎺æ≠·ÙU│àô
ŽÇ\     ÝQ⎻H@&␌┼└·├[³¯•ÓζGU

When you want to access your secret files, or if you want to put more files into ~/lock, you must first reattach it, using cattach.  You move files in or out of the attached directory in /crypt – you never put files directory into ~/lock. Then when you’re finished, you retach using cdetachYou must never forget to detach if you want to keep the secret files secret.


If you’ve got any questions or comments, don’t be shy!


Locations of visitors to this page

free web stat

Some Common Linux Commands


Linux has a well-developed graphical user interface – in fact it has several GUIs, the most popular of which are Gnome (on which Ubuntu is based) and KDE (Kubuntu‘s desktop).  But Linux also has a powerful command-line interface – also known as the console or terminal – and a great many commands to use in the CLI.

Here’s a little “cheat sheet” of common, basic Linux commands – just to get you started – you’d be wise to study this subject further if you’re serious about administering a Linux box.

Moving around in the file system
Command Action
pwd “Print working directory” – show what dir you’re in.
ls List the contents of a dir.
ls -l List the contents of a dir and show additional info of the files.
ls -a List all files, including hidden files.
cd Change directory.
cd .. Go to the parent directory.
Examining files
Command Action
file Determine the type of a file.
cat Concatenate a file.
less View text files and paginate them if needed.
Manipulating files and directories
Command Action
cp Copy a file.
cp -i Copy a file and ask before overwriting.
cp -r Copy a directory with its contents.
mv Move or rename a file.
mv -i Move or rename a file and ask before overwriting.
rm Remove a file.
rm -r Remove a directory with its contents.
rm -i Ask before removing a file. Good to use with the -r option.
mkdir Make a directory.
rmdir Remove an empty directory.

Linux Tutorial: How to use a cellphone as a modem



Note: There is more up-to-date info on this subject, especially concerning mobile broadband HSDPA modems and 3G cellphones, to be found here. But the info on this page is still relevant. In particular, this page covers the program wvdial, which can be used if your network manager doesn’t detect your HSDPA modem.

I learnt how to connect to the internet through my cellphone because it was the only way I could get online from my home – at the time I was living in a flat where I wasn’t permitted to have a regular phoneline installed. And I still sometimes find it useful: if I’m out and about with my laptop, and I can’t find a wifi “hotspot” to use, I can generally get a GSM signal – in the UK it’s possible to get a signal in just about every urban area, and in a lot of rural areas too – and a GSM signal means you can connect to the internet via GPRS.

Some mobile service plans charge for internet access on a per MB of transferred data basis. This can turn out very expensive, as there is a lot of data transferred during an internet session. Especially if you download a 3 GB movie DVD!! However, many mobile plans charge a set fee for unlimited net access. My mobile provider, Orange, charge me £1 for one day’s unlimited access or £5 for a week’s access. And I believe in the USA it’s much cheaper.

So how do you use a mobile phone as a modem? With Windows, I haven’t got a clue. But with Linux, you establish a PPP connection with the mobile service provider’s servers, by using a dialler like wvdial. Wvdial comes included with a default installation of Ubuntu (my particular distro) and probably other Linux flavours too.

Connect your phone to the computer. I do this with a USB datacable that came with the phone, but some people use Bluetooth. The phone should be ON. My phone is a Sony Ericsson – when it’s linked to the computer, I have to choose between File Transfer and Phone Mode. To use the phone as a modem, I have to select Phone Mode. However, I sometimes use a Nokia phone, and there’s no mode-choosing necessary with that model.

Open a terminal and get yourself root status. Then type in the command


This will cause wvdial to scan the computer for modems. You’ll get output something like this:

root@x-box:~# wvdialconf

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 — failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 — and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 — OK
ttyACM0<*1>: ATQ0 V1 E1 Z — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyACM0<*1>: Modem Identifier: ATI — Sony Ericsson W300
ttyACM0<*1>: Speed 4800: AT — OK
ttyACM0<*1>: Speed 9600: AT — OK
ttyACM0<*1>: Speed 19200: AT — OK
ttyACM0<*1>: Speed 38400: AT — OK
ttyACM0<*1>: Speed 57600: AT — OK
ttyACM0<*1>: Speed 115200: AT — OK
ttyACM0<*1>: Speed 230400: AT — OK
ttyACM0<*1>: Speed 460800: AT — OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK

Found an USB modem on /dev/ttyACM0.
/etc/wvdial.conf<Warn>: Can’t open ‘/etc/wvdial.conf’ for reading: No such file or directory
/etc/wvdial.conf<Warn>: …starting with blank configuration.
Modem configuration written to /etc/wvdial.conf.
ttyACM0<Info>: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
ttyACM1<Info>: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”

[Note: I’ve edited the output, to cut down on its length.]

Wvdial found my cellphone (“Modem Identifier: ATI — Sony Ericsson W300”), and reports that the phone is on port ttyACM0.

Then wvdial created a configuration file (/etc/wvdial.conf) and put some config info about the phone in it.

Edit /etc/wvdial.conf with your mobile service provider’s information. When I ran wvdialconf, the program created a wvdial.conf file as below:

root@x-box:~# cat /etc/wvdial.conf

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
; Phone = <Target Phone Number>
ISDN = 0
; Username = <Your Login Name>
Init1 = ATZ
; Password = <Your Password>
Modem = /dev/ttyACM0
Baud = 460800

The program filled in some fields, but some have been left for you to do: specifically, the info needed to log in to your mobile service provider’s web servers. I edited the file to look like this:

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Phone = *99#
ISDN = 0
Username = A
Init1 = ATZ
Password = B
Modem = /dev/ttyACM0
Baud = 460800
Stupid Mode = Yes

The number in the Phone field is the number that the phone needs to call to access my mobile provider’s GPRS service. Your mobile network may use a different number – you’ll have to ask them.

My mobile network does not require usernames and passwords to access the web servers. But wvdial doesn’t like empty fields. So I put “A” and “B” in them.

I added the last line: Stupid Mode = Yes, otherwise wvdial will simply cycle when run without ever connecting.

*IMPORTANT* All the output recreated above is from a system that did not have any other modems connected. Most laptops have a modem or network card built-in, which wvdialconf will detect. But you’ll be able to see what information relates to your phone, and edit your wvdial.conf file accordingly.

So, now you can connect to the internet. To do this, open that terminal and, as root, type in the command


You’ll get output like this:

root@x-box:~# wvdial
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99#
WvDial Modem<*1>: CONNECT
WvDial Modem<*1>: ~[7f]}#@!}!}!} }8}#}$@#}(}”}’}”}”}&} } } } }%}&}$AUSgn~
WvDial<*1>: Carrier detected. Starting PPP immediately.
WvDial<Notice>: Starting pppd at Wed Jan 16 15:45:03 2008
WvDial<Notice>: Pid of pppd: 10689
WvDial<*1>: Using interface ppp0
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: local IP address
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: remote IP address
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: primary DNS address
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: secondary DNS address
WvDial<*1>: pppd: ��[06][08]��[06][08]

The program will appear to “hang” – the above text will just freeze on the monitor. But wvdial is actually holding the connection open until you terminate the link by hitting Ctrl-C.

Now you can use the connection by, for example, starting up your web browser; or open another terminal and run telnet or ssh, or do whois or ping commands. All these activities will run a lot slower than you’re used to – but they will run.

When you’re finished, hit Ctrl-C and wvdial will end with a closing message like this:

Caught signal 2: Attempting to exit gracefully…
WvDial<*1>: Terminating on signal 15
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: Connect time 0.8 minutes.
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: Disconnecting at Wed Jan 16 15:45:50 2008

Data connections via GPRS over GSM are very slow – mine often average about 5 K/sec. But 3G/UMTS is much faster. Nowhere near the performance over a landline, of course, but 3G will probably be the best bet. However, be warned: some mobile providers don’t like their customers to link to the internet this way, and I’ve been told that 3, a UK company, actively prevent it. Their customers can pay extra to get a GPRS modem, but linking a normal cellphone on a standard plan is not permitted. Tmobile also don’t like their customers to use their phones as modems. So beware! Or, better yet, use a network that doesn’t have such stupid rules!!

_got=2;_goi=2;_goz=0;_gol=’Free hit counter’;_GoStatsRun();
Free hit counter
Free hit counter

%d bloggers like this: