Downloading and Saving a High Quality YouTube video using Firefox 3.5 (mixer posted on November 16th, 2009 )

Introduction

A lot of people want to save YouTube videos, but either find the process frustrating or wind up saving poor quality versions. This will explain two steps to get the best quality and save it to your computer.

Step 1: Changing the standard FLV version to MP4

YouTube for some time has been converting most of its content to higher quality MP4 versions. Although some of the older files don’t look much better, saving this MP4 version will almost always be better than the standard “FLV” or Flash version. Also, one noted improvement is that there will be less audio/video sync issues.

1. Find the YouTube video you want to save
2. At the end of the URL (the line of text in the address bar), add one of the following:
&fmt=18 (That’s the “and” symbol-uppercase 7 followed by fmt=18. This invokes the high quality feed)
&fmt=22 (That’s the “and” symbol-uppercase 7 followed by fmt=22. This invokes the 16:9 widescreen feed if available)

3. Click your “Go” button or press enter to reload the better quality version. To verify that you have the higher quality version, you should be able to see the “HQ” icon appear in the lower right corner of the video playback control area.

Step 2: Saving the higher quality MP4 version

In order to save the high quality version as an MP4, we’ll use a real nice bookmarklet. Note: This bookmarklet will only work with Firefox version 3.0 and above. What the bookmarklet does is place a download icon in the video additional information area. This bookmarklet doesn’t install anything and you can delete it anytime. Here’s how to install and use it.

Bookmarklet that places an “Download as MP4” on YouTube video information panel just below the “embed” area.

1. Right click on Firefox’s bookmarks and select “New Bookmark”
2. Enter a name (YouTube Download for example)
3. Copy and paste the following (below)  javascript into the “Location” properties of a bookmark.
4. Click “Add”
5. To use the bookmarklet, find the YouTube video you want to download (invoke or add the HQ comment/line to the URL as needed), then open your bookmarks and click “YouTube Download” (the name you gave it in step #2 above). A icon “Download as MP4” will appear in the video information panel. Right click this icon and select “Save Link As”. Enter a name and then click “Save”.

Javascript for YouTube download MP4 bookmarklet

javascript:if(!document.getElementById(‘download-youtube-video’)){var%20video_id=null;var%20video_hash=null;var%20video_player=document.getElementById(‘movie_player’);if(video_player){var%20flash_variables=video_player.attributes.getNamedItem(‘flashvars’);if(flash_variables){var%20flash_values=flash_variables.value;if(flash_values){var%20video_id_match=flash_values.match(/[^a-z]video_id=([^(\&|$)]*)/);if(video_id_match!=null)video_id=video_id_match[1];var%20video_hash_match=flash_values.match(/[^a-z]t=([^(\&|$)]*)/);if(video_hash_match!=null)video_hash=video_hash_match[1]}}}if(video_id==null||video_hash==null){var%20args=null;try{args=yt.getConfig(‘SWF_ARGS’)}catch(e){}if(args){video_id=args[‘video_id’];video_hash=args[‘t’]}}if(video_id!=null&&video_hash!=null){var%20div_embed=document.getElementById(‘watch-embed-div’);if(div_embed){var%20div_download=document.createElement(‘div’);var%20div_download_code=’%3Cbr%20/%3E%3Cspan%20id=\’download-youtube-video\’%3E%3Ca%20href=\”+’http://www.youtube.com/get_video?fmt=18&video_id=’+video_id+’&t=’+video_hash+’\’%20onclick=\’blur(this);\’%3EDownload%20as%20MP4%3C/a%3E’;try{if(yt.getConfig(‘IS_HD_AVAILABLE’))div_download_code=div_download_code+’%20|%20%3Ca%20href=\”+’http://www.youtube.com/get_video?fmt=22&video_id=’+video_id+’&t=’+video_hash+’\’%20onclick=\’blur(this);\’%3EDownload%20as%20MP4%20HD%3C/a%3E’}catch(e){}div_download.innerHTML=div_download_code+’%3C/span%3E’;div_embed.appendChild(div_download)}}}void(0)

Update:  While the above method may still work, I think the easiest way is to use this “Plugin” for Firefox:  https://addons.mozilla.org/en-US/firefox/addon/13990     It installs easy and works great.

COMMENTS: 7 Comments »

7 Responses

  1. Uh… sorry, where’s the JavaScript code?

  2. RH says:

    3. Copy and paste the following (below) javascript into the “Location” properties of a bookmark.

    The code seems to be missing.

  3. mixer says:

    Sorry about that. It seems that either it got hacked or deleted??? Here is the code again.

  4. Niktesla says:

    Does this method allows to download videos larger then 67 092 480 bytes ? (max size for firefox tmp cache-file)

  5. anann says:

    Now 1080p video is available, that’s end with &fmt=37 (&fmt=22 for 720p)
    You can use “video DownloadHelper” add-ons for firefox must be easier.

  6. [random name] says:

    It’s not working for me :/
    Firefox version 3.5.7

  7. Rick says:

    Or just copy the URL into YouTube Downloader HD and let a standalone app do it better.

    Okay, it’s not quite as integrated as doing it through the browser, but there’s no scripting to sort out, or the need to worry about what fmt=?? number to use. When YouTube changes little things, an update isn’t far away. It does all the formats up to 1080p HD (as if my computer has a hope in hell of playing that! :-)).

    http://www.youtubedownloaderhd.com/

    [note for the cynical – I’m not affiliated in any way with this product, I’m just happy to recommend software that does its job well]