Note:
Then place the FFMPEG components in a folder of your choice.
The whole process revolves within these bullet points:
Each video format would have their corresponding itag value. Say you want to grab a 240p video; based on the itag table below, you would most likely look for an itag that looks like this "itag%3D133". The "133" being the value of the itag that represents your link to get the 240p version of your target video.
Here's a table on some of the itags that I can grab over the world wide web:
To test this method we will use this worthless good for nothing test video from "https://www.youtube.com/watch?v=FIWjS2vOMZU". Follow these steps so you can be guided accordingly:
Reference(s) / Test Environment(s):
It is NOT piracy to use portions of YouTube videos for purposes qualified under the Fair Use Doctrine and non commercial purposes. This tutorial MUST only be used for legitimate, legal, and lawful purposes and Fair Use used for educational, news reporting, political, criticism, non commercial, and social justice purposes. YouTube gives permission to use their material for non commercial purposes. As long as you do not make any profits off the material, then you are all good. You may check by contacting them: https://www.youtube.com/t/contact_us.
Prep Up
Sure there are lots of apps out there that you can use to grab YouTube videos, but let us suppose you cannot find one that works for you at the moment; and you really need a video on YouTube for school presentation purposes or whatnot. Worry no more as you can always rely on no other than the "FFMPEG". FFMPEG is an open source all in one audio / video converter. FFMPEG is all you need (if you know how to use this bad ass tool). Before we proceed with this walk through, get your own copy of FFMPEG first from their official website: http://www.ffmpeg.org/download.html.Then place the FFMPEG components in a folder of your choice.
How It Goes
The way I understand it is YouTube separates the audio and the video (in their servers) and merge them on the fly when you watch them online. Thus, you need to get the video and the audio files first and let FFMPEG do the merging of these two components for you once you already have them.The whole process revolves within these bullet points:
- Know what audio / video quality you want to grab from YouTube.
- Find the encrypted URL of the audio / video by viewing the source code.
- Save the audio and then the video using the Save As option of your internet browser.
- Merge the audio and the video files that you got using the FFMPEG app.
It All Begins With ITAGs
When you perform a "view source" function on a YouTube video page (through your internet browser) you will see a couple or more of these itags. Most videos in YouTube would have different formats like 240p, 360p or whatnot. This is where itags come into place.Each video format would have their corresponding itag value. Say you want to grab a 240p video; based on the itag table below, you would most likely look for an itag that looks like this "itag%3D133". The "133" being the value of the itag that represents your link to get the 240p version of your target video.
Here's a table on some of the itags that I can grab over the world wide web:
Itag Value | Possible File Format | Video Resolution / Audio |
5 | FLV | 320 x 240 |
17 | 3GP | 176 x 144 |
18 | MP4 | 480 x 360 |
22 | MP4 | 1280 x 720 |
34 | FLV | 480 x 360 |
35 | FLV | 640 x 480 |
36 | 3GP | 320 x 240 |
37 | MP4 | 1920 x 1080 |
38 | MP4 | 2048 x 1080 |
43 | WebM | 480 x 360 |
44 | WebM | 640 x 480 |
45 | WebM | 1280 x 720 |
46 | WebM | 1920 x 1080 |
82 | MP4 | 480 x 360 3D |
83 | MP4 | 640 x 480 3D |
84 | MP4 | 1280 x 720 3D |
85 | MP4 | 1920 x 1080 3D |
100 | WebM | 480 x 360 3D |
101 | WebM | 640 x 480 3D |
102 | WebM | 1280 x 720 3D |
133 | MP4 | 320 x 240 Video Output |
134 | MP4 | 480 x 360 Video Output |
135 | MP4 | 640 x 480 Video Output |
136 | MP4 | 1280 x 720 Video Output |
137 | MP4 | 1920 x 1080 Video Output |
139 | MP4 | Low bitrate Audio Ouput |
140 | MP4 | Med bitrate Audio Ouput |
141 | MP4 | Hi bitrate Audio Ouput |
160 | MP4 | 256 x 144 Video Output |
Forget About Those Easy To Use Apps For Now
Novice search engine users may find it difficult to find an application that works. It is always nice to know a backup procedure for things like these.To test this method we will use this worthless good for nothing test video from "https://www.youtube.com/watch?v=FIWjS2vOMZU". Follow these steps so you can be guided accordingly:
- Paste the https://www.youtube.com/watch?v=FIWjS2vOMZU on the address bar of your internet browser and press ENTER (or RETURN or whatever equivalent key(s) you have on your keyboard).
- Right click on any blank surface near the video and choose the "view source" option. At the time of writing it should be "View Page Source" in Mozilla Firefox and "View page source" in Google Chrome.
- You may see something like the screenshot below. If the scroll bar on the bottom gives you an option to scroll from left to right, you may want to use the wrap long lines option. Helps minimize confusion when you are looking for some string of texts. Most internet browser's source viewer should have this option.
- From here we may now search for the string itag%3D by using the Find Function ofthe source viewer. Should be CTRL+F most of the time.
My check on our TNTTS test video got me these results:- itag%3D134
- itag%3D133
- itag%3D
- itag%3D140
- itag%3D18
- itag%3D5
- itag%3D36
- itag%3D17
- Suppose we decide to get the "480 x 360 Video Output" of our test video; based on the itag table above, the itag value we may be interested in is "134".
Thus, you go back to where you found the "itag%3D134". - From here, look for the first instance of the string "http" before the "itag%3D134". Then look for the first instance of "," (comma) or "\" (back slash) after the "itag%3D134".
- Copy the whole URL that you can get starting from the first "http" before the "itag%3D134" up to the last character before the first "," (comma) or "\" (backslash) appears. What I got is:
"https%3A%2F%2Fr4---sn-2aqu-hoa6.googlevideo.com%2Fvideoplayback%3Fipbits%3D0%26mime%3Dvideo%252Fmp4%26key%3Dyt5%26itag%3D134%26lmt%3D1424969366861587%26signature%3DF052AF418FF5BB6E64331B1944E3413BBF74153F.79B0EAAE866E5CCC3295919D25F60111982BF62C%26expire%3D1424992127%26mt%3D1424970500%26gir%3Dyes%26pl%3D21%26keepalive%3Dyes%26sver%3D3%26requiressl%3Dyes%26ip%3D49.148.219.12%26initcwndbps%3D507500%26id%3Do-AKM8Pb0gdhXdO77Jv0UuqP52PaO-EF4a9RdrUWor-2GO%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Ckeepalive%252Clmt%252Cmime%252Cmm%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cupn%252Cexpire%26upn%3DKWhmOf7Z3jg%26mm%3D31%26source%3Dyoutube%26clen%3D310781%26mv%3Dm%26ms%3Dau%26fexp%3D905657%252C907263%252C912150%252C926419%252C927622%252C937434%252C9405631%252C9406778%252C9407518%252C943917%252C947225%252C947240%252C948124%252C951703%252C952302%252C952605%252C952612%252C952620%252C952901%252C955205%252C955301%252C957201%252C958602%252C959701%26dur%3D16.875".
The link shown above will be the direct link to the video that we are trying to get; TNTTS test video in this case. Notice the "itag%3D134" that is underlined and bolded from within the link. - So we got our video link now but it is actually encrypted. Our next step would be to decrypt it. Nothing fancy, just look for online url decoders using your favorite search engine. Something similar to these sites:
- http://www.url-encode-decode.com/
- http://meyerweb.com/eric/tools/dencoder/
- http://urldecode.org/
Just go to these url decode sites and paste the encrypted video link that we got. Decode it until you reach the part when the decoder would not give you new decoded strings for your url.
The final string I got from the decoder is:
"https://r4---sn-2aqu-hoa6.googlevideo.com/videoplayback?ipbits=0&mime=video/mp4&key=yt5&itag=134&lmt=1424969366861587&signature=F052AF418FF5BB6E64331B1944E3413BBF74153F.79B0EAAE866E5CCC3295919D25F60111982BF62C&expire=1424992127&mt=1424970500&gir=yes&pl=21&keepalive=yes&sver=3&requiressl=yes&ip=49.148.219.12&initcwndbps=507500&id=o-AKM8Pb0gdhXdO77Jv0UuqP52PaO-EF4a9RdrUWor-2GO&sparams=clen,dur,gir,id,initcwndbps,ip,ipbits,itag,keepalive,lmt,mime,mm,ms,mv,pl,requiressl,source,upn,expire&upn=KWhmOf7Z3jg&mm=31&source=youtube&clen=310781&mv=m&ms=au&fexp=905657,907263,912150,926419,927622,937434,9405631,9406778,9407518,943917,947225,947240,948124,951703,952302,952605,952612,952620,952901,955205,955301,957201,958602,959701&dur=16.875".
- It is now time to paste the decrypted url on the address bar of your internet browser. Once loaded, you should be able to grab the video by using the "Save" or "Save As" function of your internet browser.
You should be able to save the video file as MP4. - Now that we have the video part, the next step is to get the audio portion that YouTube separated. Based on our itag table the value for a high bitrate audio would be "141". Thus, we will try to look for the "itag%3D141" string on the source code. My search did not return any "itag%3D141"; this is simply because this worthless TNTTS test video does not have any high bitrate audio.
Now, if we look for a medium bitrate audio output, which is "itag%3D140". Then copy the whole url or string from the first "http" that shows before the "itag%3D140" up to the last character before the first "," (comman) or "\" (back slash) appears. We'll get this:
"https%3A%2F%2Fr4---sn-2aqu-hoa6.googlevideo.com%2Fvideoplayback%3Fipbits%3D0%26mime%3Daudio%252Fmp4%26key%3Dyt5%26itag%3D140%26lmt%3D1424968918086776%26signature%3DB6AC0F57EAA3D0D3BC384EDC43F76240D40EB3A4.717056D3CFA682C0BFE66181FEEC1BD3FA461E33%26expire%3D1424992127%26mt%3D1424970500%26gir%3Dyes%26pl%3D21%26keepalive%3Dyes%26sver%3D3%26requiressl%3Dyes%26ip%3D49.148.219.12%26initcwndbps%3D507500%26id%3Do-AKM8Pb0gdhXdO77Jv0UuqP52PaO-EF4a9RdrUWor-2GO%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Ckeepalive%252Clmt%252Cmime%252Cmm%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cupn%252Cexpire%26upn%3DKWhmOf7Z3jg%26mm%3D31%26source%3Dyoutube%26clen%3D205234%26mv%3Dm%26ms%3Dau%26fexp%3D905657%252C907263%252C912150%252C926419%252C927622%252C937434%252C9405631%252C9406778%252C9407518%252C943917%252C947225%252C947240%252C948124%252C951703%252C952302%252C952605%252C952612%252C952620%252C952901%252C955205%252C955301%252C957201%252C958602%252C959701%26dur%3D16.949".
Like what we did with our previous ecrypted video link, we will decode or decrypt this audio link we have so we can get this decoded url string shown below:
"https://r4---sn-2aqu-hoa6.googlevideo.com/videoplayback?ipbits=0&mime=audio/mp4&key=yt5&itag=140&lmt=1424968918086776&signature=B6AC0F57EAA3D0D3BC384EDC43F76240D40EB3A4.717056D3CFA682C0BFE66181FEEC1BD3FA461E33&expire=1424992127&mt=1424970500&gir=yes&pl=21&keepalive=yes&sver=3&requiressl=yes&ip=49.148.219.12&initcwndbps=507500&id=o-AKM8Pb0gdhXdO77Jv0UuqP52PaO-EF4a9RdrUWor-2GO&sparams=clen,dur,gir,id,initcwndbps,ip,ipbits,itag,keepalive,lmt,mime,mm,ms,mv,pl,requiressl,source,upn,expire&upn=KWhmOf7Z3jg&mm=31&source=youtube&clen=205234&mv=m&ms=au&fexp=905657,907263,912150,926419,927622,937434,9405631,9406778,9407518,943917,947225,947240,948124,951703,952302,952605,952612,952620,952901,955205,955301,957201,958602,959701&dur=16.949". - Following the same procedures from steps 6, 7, 8, and 9; we should be able to save our medium bitrate audio file as M4A format.
- At this point we should now have the video and the audio files of our TNTTS test video on YouTube.
- Go to where you kept the FFMPEG folder. It may most likely show you these folders:
- bin
- doc
- licenses
- presets
- Copy the video and audio files into FFMPEG's bin folder.
- This was tested on the "ffmpeg-20150220-git-6c91afe-win64-static" version. You should see a batch file included in your copy of FFMPEG. The file is named "ff-prompt.bat". Run this file, then it should give you a command prompt.
- To combine the video and audio files we type in this command on the command prompt (the one that showed when we run the ff-prompt.bat included in our FFMPEG copy):ffmpeg -i filename_of_our_video_file.mp4 -i filename_of_our_audio_file.m4a -vcodec copy -acodec copy final_filename_of_the_file_that_you_want.mp4
You can learn more parameters / switches on how you can fully utilize FFMPEG from their ffmpeg Documentation website. - Here a quick video tutorial we prepared for our avid readers:
Reference(s) / Test Environment(s):
- Itag table taken from sunxvogy (https://github.com/sunxvogy).
- The Non-Technical Technical Support Admin.
- Tested on Windows 7, and "ffmpeg-20150220-git-6c91afe-win64-static".
- Should work until YouTube change the way they encrypt their video links.
Get YouTube Videos
Reviewed by Admin Moronman
on
3:43 PM
Rating:
GetYoutubeVideos.com for downloading Youtube video's in all available formats.
ReplyDeleteNo company can deny it. YouTube marketing has opened up whole new doors in advertising opportunities. Online tools are the biggest resources companies have to reach a huge audience simultaneously, and the bigger the audience is, the better the tool. Social networks like Facebook and Twitter have gained marketers' recognition as advertising outlets, but YouTube is close behind in terms of visitation and allows businesses to market their products through online video. vues youtube
ReplyDeleteThanks for this article very helpful. thanks. YouTube subscribers
ReplyDelete