Watch YouTube videos using youtube-dl

Trisquel includes Gnash by default, so YouTube videos should work most of the time. However, watching YouTube videos this way requires the user to run proprietary JavaScript and ActionScript. It also requires more system resources than downloading the videos and viewing them with a video player, such as Totem or SMPlayer.

YouTube videos can be downloaded on Trisquel via youtube-dl. youtube-dl is free software and is capable of downloading videos from YouTube and other video websites.

NOTE: youtube-dl can execute proprietary JavaScript code. A modified version of youtube-dl, AVideo, was written to avoid this.

Installing youtube-dl

  • Open Terminal
  • Use the following command to download the youtube-dl program:
     sudo aptitude install youtube-dl
  • Update to a more recent version:
     sudo youtube-dl -U
    Do this step whenever youtube-dl stops working due to changes in the YouTube website.
  • The first time you update youtube-dl using this method, you will need to run it as root:
     sudo youtube-dl

Now, you can use the youtube-dl command to download YouTube videos. First, find out which formats are available by using the following command and replacing the shown URL with the URL of the video you wish to download.

 youtube-dl -F
The output will look like this:
[youtube] Confirming age
[youtube] 8p9IU4zp7mU: Downloading webpage
[youtube] 8p9IU4zp7mU: Downloading video info webpage
[youtube] 8p9IU4zp7mU: Extracting video information
[youtube] 8p9IU4zp7mU: Downloading DASH manifest
[info] Available formats for 8p9IU4zp7mU:
format code extension resolution  note 
139         m4a       audio only  DASH audio   48k , audio@ 48k (22050Hz), 788.95KiB (worst)
140         m4a       audio only  DASH audio  127k , audio@128k (44100Hz), 2.06MiB
141         m4a       audio only  DASH audio  255k , audio@256k (44100Hz), 4.13MiB
160         mp4       192x144     DASH video  112k , video only, 1.79MiB
133         mp4       320x240     DASH video  245k , video only, 3.94MiB
134         mp4       480x360     DASH video  309k , video only, 4.57MiB
135         mp4       640x480     DASH video  545k , video only, 8.59MiB
17          3gp       176x144     
36          3gp       320x240     
5           flv       400x240     
43          webm      640x360     
18          mp4       640x360     (best)
Unfortunately, the video may come in a patent-encumbered format, like MP4. To receive videos in a free format like WebM, you may use the following command:
 youtube-dl -f webm -o '%(title)s.%(ext)s'
The " -o '%(title)s.%(ext)s' " part tells youtube-dl to save the video using the video's original title. More saving options can be found by running "youtube-dl -h"):

youtube-dl will then start downloading the video. The output will look something like this:

[youtube] 8p9IU4zp7mU: Downloading webpage
[youtube] 8p9IU4zp7mU: Extracting video information
[youtube] 8p9IU4zp7mU: Downloading DASH manifest
[download] Destination: Richard Stallman - DRM.webm
[download] 100% of 3.88MiB in 00:16

Alternative way for installing/upgrading youtube-dl

There is another way to have youtube-dl installed, using the pip Python package manager/installer:
sudo aptitude install python-pip
sudo pip install youtube-dl
Upgrading is as simple as
sudo pip install -U youtube-dl


11/22/2012 - 08:51
08/04/2013 - 06:12
08/13/2013 - 19:19
02/05/2014 - 19:56
09/04/2014 - 03:53
10/09/2014 - 12:08
12/04/2014 - 06:26
08/17/2017 - 06:51