An alternative way to play YouTube videos without using Flash

Outdated content
Posted on 15.12.2012 by Kim N. Lesmer.
Using or recommending Flash is equivalent to promoting proprietary software. In addition, the audio and video codecs are patented, and the complete specification for making a compatible Flash player is not available. Most people use Flash to watch videos on YouTube and this document describes an alternative way to watch YouTube videos without installing Flash.
Update 26.07.2016: Some of the information regaring "youtube-dl" in this tutorial is outdated. I recommend you take a look at the website for the latest information on usage: [https://rg3.github.io/youtube-dl/](https://rg3.github.io/youtube-dl/) Using or recommending Flash is equivalent to promoting proprietary software. In addition, the audio and video codecs are patented, and the complete specification for making a compatible Flash player is not available. Most people use Flash to watch videos on YouTube and this document describes an alternative way to watch YouTube videos without installing Flash.

This tutorial was mostly relevant before YouTube began supporting HTML5, which is capable of showing the videos without using Flash. Currently YouTube are running a trial for HTML5, but it is working really well in most updated browsers. The tutorial is still useful however if you need to download videos from YouTube, or some other video service, in an easily manner and watch them on your favorite video player.

Proprietary software or closed source software is computer software licensed under exclusive legal right of the copyright holder. The licensee is given the right to use the software under certain conditions, while restricted from other uses, such as modification, further distribution, or reverse engineering.

Vendors typically distribute proprietary software in compiled form, usually the machine language understood by the computer's central processing unit. They typically retain the source code, or human-readable version of the software, written in a higher level programming language. This scheme is often referred to as closed source.

By withholding source code, the software producer prevents the user from understanding how the software works and from changing how it works. The problem with this practice is that proprietary software may contain secret or malicious features. Richard Stallman, founder of the Free Software Foundation, says that proprietary software commonly contains "malicious features, such as spying on the users, restricting the users, back doors, and imposed upgrades." And he is quite right.

A major problem with the current Flash specification is that the audio and video codecs are patented. This is a problem in countries that consider software patents to be valid because anyone who implements Flash must either pay for a patent license to use the audio and video codecs specified (namely the Sorenson Spark video codec, the most widely-used Flash codec, used by default on YouTube) or they must pass that cost onto the distributors and/or consumers.

Most free software projects don't have the money to obtain patent licenses but even if they did, keeping track of the number of installed copies would be impossible due to the nature of free software distribution. Setting a requirement that the end user seek a patent license is normally incompatible with most free software licenses as well.

Adobe's Open Screen Project may have confused people into thinking that the Flash specification is totally open and free but, according to the Swfdec and Gnash project leads, it omits "huge amounts" of information needed to implement Flash. Additionally, the Flash specifications available from Adobe are distributed under a non-free license:

"This manual may not be copied, photocopied, reproduced, translated, or converted to any electronic or machine-readable form in whole or in part without written approval from Adobe Systems Incorporated."

When people try to create their own independent implementations, Adobe steps in to stop them: In May 2009, Adobe submitted a takedown notice to SourceForge.net requesting that the rtmpdump project be removed from their site. Source Forge.net complied.

The major implication of this takedown notice is that Adobe has definitively told us that a fully-compliant free software Flash player is illegal. This is because RTMPE is part of Flash, circumventing RTMPE is illegal (in the U.S. at least), and Adobe will never give a key to a free software project since they cannot hide the key. As a result, we can never have a fully compliant free software Flash player that's legal to use and distribute, even if we ignore the codec patent problems.

So what can we do instead?

There exists several ways to watch YouTube videos without using Flash. This tutorial describes one simple way to do it on GNU/Linux or BSD. It contradicts the purpose of this tutorial to describe how to do it on Microsoft Windows since Microsoft Windows is Proprietary software in itself which should be avoided all together.

One way to watch Flash videos from YouTube without installing Flash is to download the video first and then watch them afterwards.

There exists several YouTube downloaders, but one really good Open Source program which is also in active development is youtube-dl

The source code is located at Github at https://github.com/rg3/youtube-dl

On Debian Squeeze you can install youtube-dl from Debian Backports with:

# apt-get -t squeeze-backports install youtube-dl

After you have installed it you need to update it to contain the latest Youtube signatures:

# youtube-dl --update

Currently this has to be done twice so run the same command again:

# youtube-dl --update

youtube-dl can download videos from Youtube into a variety of video formats. You just need to make sure that your favorite video player supports the format you choose.

Besides downloading videos from Youtube youtube-dl can also download videos from a lot of other places. Take a look using the command:

$ youtube-dl --list-extractors

In order to determine the available video formats for a specific video you want to download, simple supply the URL of the video in double-quotes. In this example we will look at the available video formats for downloading the new Superman trailer (Man of Steel) located on Youtube at: http://www.youtube.com/watch?v=KVu3gS7iJu4

$ youtube-dl --list-formats "http://www.youtube.com/watch?v=KVu3gS7iJu4"
[youtube] Setting language
[youtube] KVu3gS7iJu4: Downloading video web page
[youtube] KVu3gS7iJu4: Downloading video info web page
[youtube] KVu3gS7iJu4: Extracting video information
Available formats:
37      :       mp4     [1080x1920]
22      :       mp4     [720x1280]
35      :       flv     [480x854]
34      :       flv     [360x640]
18      :       mp4     [360x640]
43      :       webm    [360x640]
5       :       flv     [240x400]
17      :       mp     [brimful]

So as we can see we have a variety of formats to choose from. Often the format itself is a proprietary video format, but some Open Source video players can display proprietary video formats using an Open Source alternative. VLC is a really good choice.

VLC uses the library called Libav Libav is a friendly and community-driven effort to provide its users with a set of portable, functional and high-performance libraries for dealing with multimedia formats of all sorts.

Another great Open Source media player is Mplayer.

To proceed, if you want to download the above trailer in MP4 720X1280 you need to use the following command:

$ youtube-dl -f 22 "http://www.youtube.com/watch?v=KVu3gS7iJu4"

The -f option specifies what format you want to download the video in. Use the command to see a list of other options available:

$ man youtube-dl

The downloaded video will be saved with the query string as the name of the video plus the extension. So this video gets saved as "KVu3gS7iJu4.mp4"

Now, you can watch the video using Mplayer or VLC or something else.

$ mplayer KVu3gS7iJu4.mp4

Another really great feature of youtube-dl is that is it capable of downloading complete playlists and it can then automatically add numbers and the correct titles to the downloaded filenames.

If you have a playlist you can download every file automatically and add numbers and titles like this:

$ youtube-dl -t -A "http://www.youtube.com/playlist?list=foo"

The -t option makes youtube-dl use the title of the video in the filename. The -A option makes youtube-dl add numbers starting from 00000.

I hope this tutorial helps you in the steps to avoid proprietary software all together!

If you have any comments or corrections feel free to email me.