About
SaveTube is a JavaScript application that allows downloading videos from video sharing web sites by adding on the bottom right of the page window a menu with all formats and definitions of the video. Below are all supported sites. There is an extra script that gets all video streams from an web page.


Sites
The main video sharing web sites on which you can watch videos using SaveTube.



Installation
Installation
Read the following information on how to install the script in different browsers.


Firefox
To work in Firefox based browsers the script has to be installed with one of Greasemonkey, Tampermonkey or Violentmonkey add-ons from Mozilla Add-ons. Or install the SaveTube add-on from Mozilla Add-ons or manually download and install it from here.

Chromium
To work in Chromium based browsers the script has to be downloaded then dragged and dropped in the extensions page or installed with the Tampermonkey or Violentmonkey extension from Chrome Web Store. Or manually download and install the SaveTube extension from here.

Pale Moon
To work in Pale Moon or Basilisk it is required to install the Greasemonkey extension.

Falkon
To work in Falkon (QupZilla) it is required to enable the GreaseMonkey extension.

Opera
To work in Opera the script has to be downloaded then dragged and dropped in the extensions page or installed with extensions, Tampermonkey from Opera Add-ons or Violentmonkey. Or manually download and install the SaveTube extension from here. For versions older than 15 download and save the script in the JavaScript files directory and enable "User JavaScript on HTTPS" in "opera:config" or use the Violentmonkey extension.

Safari
To work in Safari it is required to install the Tampermonkey extension.



Usage
Usage
Read the following information on how to use the script.


Select the video from the menu or use the options window to select the preferred video definition and container.

Download
Click this button to save the video stream. The script will try to download the video directly when the browser supports this feature. The second icon is shown while downloading. If the browser doesn't support direct download the script will show a link. Click "Link" and the browser will show the open popup window. Some browsers don't have this feature and will open/play the video, for these right click (two-button mouse) or control and click (single-button mouse) 'Link' and 'Save link as'.

DASH
Some sites use DASH streams, which are audio only and video only. These are shown in the videos menu as "Video Only" and "Audio Only". Download both streams and use an external tool to multiplex them. This can be made automatic, enable DASH download support in the options window and the videos menu will show new videos as "Video With Audio". You can download these using a browser protocol and an external script, read below for more details.

HLS
Some sites use HLS streams, which breaks the stream into a sequence of small chunks. These are shown in the videos menu as "HLS". You can download these using a browser protocol and an external script, read below for more details.


Options
Click the vertical dots to open the options window.

Definition (SD, HD etc.)
Select the default (highest) video definition.

Container (MP4, WebM etc.)
Select the default video container.

Open Page Link
Enable/disable auto selection of the page link as the default option in the videos menu. This requires a browser protocol. With this option enabled only the page link is sent to the external application which gets and downloads the streams.

Autosave
Enable/disable video auto-download. If it's on the video download will start when the video page is loaded or when a new video format is selected. This works for "High Definition MP4" YouTube videos or if the browser supports direct download.

Show Save Link
Enable/disable showing the stream link when clicking the download button. When it's on the direct download is disabled.

Save DASH
Enable/disable DASH streams (video with audio) download. This requires a browser protocol and an external application for muxing the audio and video streams



Linux
How to download DASH, HLS or any video on Linux and BSD platforms:

1 Create the savetube script, bash example using ffmpeg for HLS and DASH (audio and video streams multiplexing) or youtube-dl for downloading any video

savetube.sh
#! /bin/bash

d="/home/Video/YouTube"
i="$(echo "$1" | sed -e "s/savetube://" -e "s/SEPARATOR/|/g")"
t="$(echo "$i" | cut -d "|" -f 1 | sed -e "s/%20/ /g" -e "s/ +$//" -e "s/^ +//")"
v="$(echo "$i" | cut -d "|" -f 2)"
a="$(echo "$i" | cut -d "|" -f 3)"
f="$(echo "$v" | grep -qi "video/webm\|\.webm" && echo "webm" || echo "mp4")"
if [ "$a" = "" ]; then
   if echo "$v" | grep -qi "\.m3u8"; then
      ffmpeg -y -i "$v" -c copy "$d/$t.$f"
   else
      youtube-dl "$v" -o "$d/$t"
   fi
else
   ffmpeg -y -i "$v" -i "$a" -c copy "$d/$t.$f"
fi


2 Create the savetube protocol file in ~/.local/share/applications

savetube.desktop
[Desktop Entry]
Name=SaveTube Protocol
Exec=/path/to/savetube.sh %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/savetube


Enable protocol:
xdg-mime default savetube.desktop x-scheme-handler/savetube


Test:
xdg-open savetube:http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4


3 Activate the protocol

Click here to associate the script to the protocol

3.4 Enable DASH download support in the options window



Windows
How to download DASH, HLS or any video on Windows:

1 Create the savetube script, batch example using ffmpeg for HLS and DASH (audio and video streams multiplexing) or youtube-dl for downloading any video

savetube.bat
@echo off
setlocal

set "d=D:\Videos"
set "i=%~1"
set "i=%i:savetube:=%"
set "i=%i:SEPARATOR=|%"
for /f "tokens=1,2,3 delims=|" %%a in ("%i%") do (
   set "t=%%a"
   set "v=%%b"
   set "a=%%c"
)
set "f=mp4"
if not "x%v:video/webm=%"=="x%v%" set "f=webm"
if not "x%v:.webm=%"=="x%v%" set "f=webm"
if "%a%"=="" (
   if not "%v:.m3u8=%"=="%v%" (
      "C:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "%v%" -c copy "%d%\%t%.%f%"
   ) else (
      "C:\Program Files\ytdl\youtube-dl.exe "%v%" -o "%d%\%t%"
   )
) else (
   "C:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "%v%" -i "%a%" -c copy "%d%\%t%.%f%"
)


3.2 Create the savetube registry file, change the script path and execute it

savetube.reg
REGEDIT4

[HKEY_CLASSES_ROOT\savetube]
@="URL:savetube Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\savetube\shell]

[HKEY_CLASSES_ROOT\savetube\shell\open]

[HKEY_CLASSES_ROOT\savetube\shell\open\command]
@="\"D:\\Scripts\\savetube.bat\" \"%1\""


3.3 Activate the protocol

Click here to associate the script to the protocol

3.4 Enable DASH download support in the options window