View Single Post
  #58  
Old 06-22-2013, 12:19 PM
Spinnaker2001 Spinnaker2001 is offline
Junior Member
 
Join Date: Jun 2013
Posts: 11
Spinnaker2001 is on a distinguished road
Default

Re: How to dump youtube live TV stream to file using commandline?


I'm surprised nobody has mentioned the youtube-dl CLI tool. I personally use it on Ubuntu Linux but it also is supported by Windows and OSX, here is a link to their site: http://rg3.github.io/youtube-dl/

Its insanely simply to use, here is a usage example:
In this example, I will use this YouTube video: http://www.youtube.com/watch?v=bV9L5Ht9LgY

Note: For me this downloaded the video's 1080p resolution with h.264/aac codecs (iTag 37 which Ill explain later).

The filename of the video was that of the URL's video, simply bV9L5Ht9LgY.mp4 if you want to download the video with the video's title as the file name simply use this command:

Code:
youtube-dl http://www.youtube.com/watch?v=bV9L5Ht9LgY -o %\(stitle\)s\.%\(ext\)s
The filename that was downloaded was: Download_Youtube_Playlist_with_Youtube-dl.mp4

If you want to specify the resolution or codec type for the video you can easily do so by using the iTag value that YouTube uses. To view a list of the video's iTag values (without downloading the video) use the -F flag in the command:
Code:
youtube-dl -F http://www.youtube.com/watch?v=bV9L5Ht9LgY -o %\(stitle\)s\.%\(ext\)s
The result will look as such:
Code:
[youtube] Setting language
[youtube] bV9L5Ht9LgY: Downloading video webpage
[youtube] bV9L5Ht9LgY: Downloading video info webpage
[youtube] bV9L5Ht9LgY: Extracting video information
Available formats:
37	:	mp4	[1080x1920]
46	:	webm	[1080x1920]
22	:	mp4	[720x1280]
45	:	webm	[720x1280]
35	:	flv	[480x854]
34	:	flv	[360x640]
18	:	mp4	[360x640]
43	:	webm	[360x640]
5	:	flv	[240x400]
17	:	mp4	[144x176]
Since I'm a geek for mp4 I'm going to go with the the 37 iTag value and use the video's title as its' file name:
Code:
youtube-dl -f 37 http://www.youtube.com/watch?v=bV9L5Ht9LgY -o %\(stitle\)s\.%\(ext\)s
If your curious, all of YouTube's iTag values are listed here: http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs

Lastly, this awesome tool is not limited to just YouTube. It also works on a list of other sites like Vimeo, DailyMotion, DepositFiles, CollegeHumor, etc etc. A list of all sites this works with is available here: http://rg3.github.io/youtube-dl/documentation.html#d4
Reply With Quote