Jimmy's Blog Jimmy Ruska's Blog
High Quality on Youtube Posted on Tuesday, March 11 2008

Youtube has slowly started to create better quality versions of many videos, adding links that say, "Watch this video in higher quality." See this High Quality example and compare it to Youtube's Normal Quality.

Comparison of Normal Youtube vs Youtube High Quality

-Normal YoutubeHigh Quality Youtube
Screen Res.320 x 240480 x 360
Bitrate~200 kbps~900 kbps
Audio22KHz 64 kbps Mono ABR44.1KHz 96 kbps Mono CBR
Frame Rate3030
Video CodecFlash SorensonFlash Sorenson
Audio CodecMp3Mp3

Update: HD Quality & Embedding

Checkout this video with fmt=22. The specs are 1280 x 720, 30fps, 2000kbps video AVC, 232kbps audio AAC, 44.1khz stereo. Most videos don't support this yet or do not meet the (unknown) requirements. To embed youtube HD quality add &ap=%2526fmt%3D22 to the end of the embed code urls.

Getting iPod compatible mp4s!

Adding &fmt=6 to the end of any youtube video's url will give you Youtube's new high quality setting. Changing the number from 6 to something else yields different formats though it's not obvious which numbers work. Format 18 generates an mp4 using h264 with AAC stereo, which is compatible with video iPods. This is way better than using a service like vixy.net, which transcodes the crappy quality youtube vid into an mp4. Using fmt=18, you get a video transcoded from the original clip the user uploaded. The bitrate is lower on the mp4 version, but since the resolution is smaller it compensates. The h.264 codec has better looking videos at lower bitrates anyway. We finally see stereo on youtube with the mp4 version! It has a widescreen 16/9 aspect ratio rather than 4/3.

Correction:

Previously I thought the mp4 screen resolution was 480 x 270, but it's also 480x360. If the video is a smaller resolution it won't make it bigger, but 480x360 seems to be the max increase. It could be that both formats have the possibility to be 480x270 if their aspect ratio is close to 16/9 width/height. The mp4 version may add an additional small audio gain and a small sharpening effect.

-fmt 18 / MP4fmt 6 / HQ FLV
Screen Res.480 x 360480 x 360
Bitrate≅ 512 kbps≅ 900 kbps
Audio44.1KHz 128 kbps Stereo44.1KHz 96 kbps Mono CBR
Frame Rate2430
Video Codech.264Flash Sorenson
Audio CodecAACMp3

Downloading the MP4 and High Quality Videos

Video downloaders like keepvid still work. Enter the url, click download, now grab the link and add &fmt=6 or &fmt=18 (for mp4) to the end. The good people at lifehacker created an easy to use firefox extension that will put a download link under each vid. You can also get the download url if you follow my wireshark tutorial but the process is pretty tedious.

You can do it manually too, but it's annoying. Go to any video on youtube, right click then click view source. Click ctrl+F, which will open a searchbox and type &t=. Next copy the value after the t= but before any "&" characters. Grab that and the video_id and your set. The vid id is the v=something part of the url. Just copy the variables into the url below.


www.youtube.com/get_video?video_id=&t=&fmt=18

Example
Vid URL: http://www.youtube.com/watch?v=pVYp2sgA9M0
Find the &t= in the page source and attach to template url above, then download. The &t= var expires so you cannot setup permalinks to video download urls.


You may want to pass it to a download manager like wget. If you load it in the browser it will display a bunch of gibberish while it loads the entire video's ASCII representation into your browser.

Howto Get Videos to Play HQ by Default

This option has not been implemented on many accounts but the howto is already present in the youtube help pages. You need a youtube account to be able to do this.

  1. Go to your Account page.
  2. Under �Manage My Videos� click the �HQ Video Playback Setting� link.
  3. Select the playback setting that makes sense for you.
  4. Click the �Save� button.

Criteria for a Video to Become HQ

The exact settings aren't know yet for the video to become high quality. We could assume that the exact minimum settings are the same as encoded format listed above, however youtube has changed their "best format to upload high quality" help page to set the video resolution to 640 x 480. Maybe high quality will support different formats and aspect ratios in the future. It's best to upload as high quality as possible. The new multi video uploader makes it easy on a unreliable connection. Even if your upload times out or you get disconnected it will restart the uploading process exactly where it left off.

Embed High Quality Youtube Clips

Update

This code works fine to embed the mp4 version. The magic query string var is "&ap=%2526fmt%3D18" specifying format 18. Just replace (VIDEO EMBED URL) with the video ID. Note that there's a huge disadvantage in that there is no seeking. The fmt=6 embed version is less reliable.


<object width="480" height="397"><param name="movie" value="(VIDEO EMBED URL)&ap=%2526fmt%3D18"></param><param name="wmode" value="window"></param><embed src="(VIDEO EMBED URL)&ap=%2526fmt%3D18" type="application/x-shockwave-flash" wmode="window" width="480" height="397"></embed></object>

Ignore Below

Currently there is no official way to embed the High Quality videos on your website / myspace / blogs. It's possible, but a big hassle, and it's impossible to turn off autoplay. Here's an example you can embed if you want to see it for yourself.



Remove the line breaks for best results

<object width="425" height="355"><embed autoplay="false" quality="high" src="http://www.youtube.com/player2.swf" flashvars="vq=2
&sourceid=r
&video_id=pVYp2sgA9M0
&l=239
&sk=5E_4xTZlkQqZYuyEXwBRzQU
&fmt_map=18/512000/9/0/115
&t=OEgsToPDskItDX5Cg05utBXEP1wh76mc
&hl=en
&plid=AARIM8FsSohHKlMVAAAAIIAoQAA
&playnext=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>



It only works with youtube's in-site player, player2.swf, rather than the player youtube has for embeds. The problem is youtube's in-site player does not have a variable to turn autoplay on or off and if you try embedding it to your site flash issues a warning that the script is trying to contact a remote server (youtube.com). Player2.swf seems to have an internal "ap" variable hidden in the actionscript but it seems to just break the vid no matter what options I set. The key flashvar for high quality is "fmt_map=6/0/7/0/0" and "fmt_map=18/512000/9/0/115" for mp4s. When enabled, the flv file comes from cache.googlevideo.com/videoplayback?itag=6, without the fmt_map var it comes from cache.googlevideo.com/get_video, with normal quality.

To embed a high quality video you need to go to the video's page on youtube, view source, and grab the flashvar data. The most important vars are video_id, t, and sk. Just use the above embed code as a template and replace those values. As for the rest: L defines how long the video is in seconds, hl is the home language, plid tries to find any associated playlists, playnext plays the next item on the playlist if there is one.

Making your youtube videos High Quality

Youtube will be automatically creating high quality versions of many videos for those that meet the guidelines. The video quality is bad on youtube, partly because youtube encodes to such a small screen resolution with a low bitrate, but mainly because people post really low quality videos.

The crappy resolution youtube is actually what got it so popular. Google video had originally allowed 640 x 480 with a great bitrate, but they failed miserably to compete against youtube (so they later bought em out). It made online video making / viewing possible even on crappy connections. Take the time to resize your vid and sharpen it a bit before uploading. A little noise reduction and color correction can't hurt either. Use virtualdub and avisynth. They're free. Use xvid or x264 and lame acm for the audio. Divx is fine if you can get the pro version. See doom9 for tons of guides on video creation / editing / improvement.

Youtube High Quality Hack

There is also a hack using total video converter where if you make an flv with certain settings you can upload a video of super high quality and have youtube keep the screen resolution and bitrate.

Youtube High Quality Hack Settings Howto

Select what you want to encode into an flv in total video converter with these settings.

Sample Rate: 44100 Hz
audio bit rate: 320.000 kbit/s
Audio codec: mp3
Custom video bit rate: any
Resolution: any

Cons

It messes up the time on the video. A 30 second video can read as 9 minutes. The way it tells how long the video is seems very random but it constantly says the video is much longer than it really is. Having the resolution or bitrate too high causes it to not stream well and get stuck.




Tags: youtube upload timeout, high quality embed, autoplay banners, h264vfw, h264 vfw, virtualdub h.264 howto, guide, video, vedio, hq, streaming, bitrate, recommended, resolution, youtube hd, youtubehq, yt, youtubehd, hdtv, doom9, download high quality flv, crf9vobv-ec, hack, hacking, private videos, delutube, query string variable fmt, youtube hq downloader, download form



stumble digg delicious


Blog by Jimmy Ruska
Add me: Youtube, Twitter, Facebook, MySpace

Share:

More OMFG-Good Links

See all Posts in the Funny Pictures category.
Download mp3s faster than limewire using google.
I've made 100+ free video tutorials.
See the best of the internet today on one page.