NoFlash - Watch Online Videos with Mplayer


Adobe's flash implementation on linux is inefficient, consumes too much CPU, does not work well with embedded systems / older hardware, and various security issues associated with it pops up frequently.

I was looking for a good solution to avoid flash for sometime. There are a few commandline utilities such as youtube-dl, clive, cclive, quvi that can download online videos if you copy and paste the URL the video resides in from dozens of online video sites. They do what they do well, but this approach was a bit cumbersome for me. I wanted to be able to just visit the web sites, use their navigation, links etc., and automagically have the videos pop up and play in mplayer as I navigate.

My home entertainment system is a linux box connected to a TV and we watch TED talks or other online videos on it. I also wanted to be able to conveniently send video links for it to play from other computers we may have around (laptops, tablets, smartphones).

Here are the requirements I had in mind:

  • User space (does not require root access).
  • A lot less CPU consumption. Should work on embedded systems or older hardware.
  • Lightweight. No heavy dependencies.
  • Handle as many sites as possible (using multiple tools if needed).
  • Seamless and convenient to use. Ideally, just surf around.
  • No delay. Should not have to wait for the whole video to download. Just stream as quickly as possible.
  • Basic remote control capabilities.
  • Ability to surf on one computer (e.g. laptop), play stuff on another computer (my big screen TV).
  • Not overly complicated code (my approach is less than 200 lines including comments).
Since I did not find a solution that satisfied most of the above, I hacked one up myself.

How does it work?

Two components:
  • A basic web server that listens to http requests.
  • Client that sends http requests to the server.

The client can be a javascript bookmarklet, a geasemonkey script etc. For now, let's assume that it is a greasemonkey script that, after loading a page, pings the server with the URL you are currently visiting.

Server is a simple and fairly small bash script hacked up via netcat (no perl/python etc.). Requests are just URLs that the client sends. Server parses the URL, matches it against the patterns the extractors (youtube-dl, quvi etc.) support, tries to extract an actual video URL, and plays it by streaming it via mplayer. (It can do more, but we will get to that later).

If everything is set up properly, you just visit a supported online video site (e.g. youtube), browse around, and videos are started in the background using mplayer. They just pop up.


Assuming that you are using a GNU/Linux distribution, make sure you have the following packages installed:

  • A version of netcat (e.g. netcat-openbsd)
  • mplayer (or your favorite player with similar capabilities).
  • youtube-dl (optional)
  • quvi (optional)
  • Firefox or another browser with greasemonkey (optional).

You need one or both of youtube-dl and quvi. I use both, since combined, they cover more web sites. If you are happy with just one, that is fine too.

For debian wheezy you can do:

$ apt-get install netcat-openbsd youtube-dl quvi mplayer xul-ext-greasemonkey

For other distros, just use your favorite package manager and install equivalent packages. The rest of the stuff that is needed is pretty standard (grep, awk, sed etc.). They are probably already installed but if not, just install the appropriate package(s).

If you look closely, you may notice something weird. The contents of all of those files above are the same. In fact they are just symlinks to noflash which is all you need to download actually. Noflash is, what I call, a chameleon script. The same file is

  • A valid bash script that runs the server.
  • A valid html page you can render.
  • And a valid javascript or greasemonkey script you can use.

Have a look at the code and start the server via:

$ bash noflash

It should output something like this:

NoFlash  Copyright (C) 2013  Bilgehan Uygar Oztekin,  License: GPLv3
Watch online videos without flash using mplayer, quvi, youtube-dl etc.

This script is a valid bash script, greasemonkey (gm) script, and an html page.
- As a bash script, becomes a web server accepting the following request types:
  - http://*  -> Play a remote video extracted from URL.
  - file://*  -> Play a local video at the specified path.
  - mplayer:* -> Send command to mplayer running in slave mode.
- Server has a basic web interface to control mplayer, submit URLs, or download
  a js bookmarklet and/or a gm script.  Gm script pings the server with visited
  web pages (http only).  Js bookmarklet sends the current page when clicked on.

How to use it:
- On server, run this as a bash script (e.g. bash noflash).
- On client (can be the same machine), go to http://localhost:9000
  and install the javascript bookmarklet and/or the greasemonkey script.
- With the gm script, videos from supported sites should start automatically as
  you browse.  If you prefer to use the js bookmarklet, click on it to initiate.
- Server binds to localhost only by default.  Change NOFLASH_SERVER to server's
  IP to be able to access and remote control it from other computers (clients).
- See for more information.

Server listening on http://localhost:9000

To setup the client portion, point your browser to the link it provides at the last line above (http://localhost:9000 by default). You should see a page like this. Using the links the server provides, install the greasemonkey script and/or the javascript bookmarklet. Note that the server needs to be running everytime you want to use NoFlash, but you only need to setup the client portion once.

If everything is set up properly and the greasemonkey script is installed and enabled, whenever you visit a video page that is supported, it will be launched within mplayer. If you are using the bookmarklet instead, click on it to launch the video.

If you would like to use this script along with flash plugin I recommend installing flashblock extension to avoid the same video running on both mplayer and within the browser simultaneously. If you come across a video that the script cannot handle, you can just click on it to start.

Remote Access

Server actually accepts the following types of requests:
  • /http://* -> Attempt to play the video found in the URL. This is what we discussed so far.
  • /file://* -> Attempt to play this local file.
  • /mplayer:* -> Send the command to mplayer running in slave mode.
  • /noflash.user.js -> Send itself as a Greasemonkey script.
  • / -> Send itself as a bash script (file content is the same as noflash.user.js).
For security, noflash binds to localhost only by default. You can change this by editing the script. Assuming that your server's IP number is, modify this line:
to look like:
to bind to that specific IP. Run the modified script on the server. Let's call this, the TV.
  • On another machine (client), point to, install the greasemonkey script / bookmarklet.
  • On the client (e.g. laptop), go to, or your favorite online video site and pick a video.
  • Video is automatically played on the TV (with greasemonkey) or after you activate the javascript bookmarklet.
  • Control the video via the web browser on your client (pointing to

See this link for more information about available commands for mplayer.

Does it work on other operating systems?

Not tested. It may work on other unix-like systems including BSDs (or OSX) with little or no modifications provided that you have the necessary packages installed. I don't have plans to support windows.

If you get it to work on other operating systems or have additions/modifications, let me know and I will be happy to update the script and/or provide a link.

Similar projects

  • ytmp and the more recent, sniffy. Somewhat close to what I wanted. They sniff network traffic and they are browser agnostic (does not require greasemonkey). Neat and clean solution, but the "server" portion needs to run as root and they do not seem to have "play local file" or "remote control" capabilities.
  • youtube-dl, clive, cclive, quvi. Commandline tools to extract / and or download videos from online video sites. Cool stuff. Footprints and site coverage vary. NoFlash uses some of them internally.


NoFlash is available under the GNU General Public License, Version 3


Feedback/suggestions are welcome. I can be reached at oztekin at cs dot umn dot edu.
Copyright © Bilgehan Uygar Oztekin