Log in

View Full Version : Embedding YouTube HD Videos: Here's How


Jason Dunn
01-31-2009, 06:24 PM
<p>YouTube has been getting in on the HD bandwagon lately, and the results are definitely an improvement over the high-quality option - as long as the original video looks good enough. But what if you want to embed your HD video on your own Web site? Mark Robertson over at <a href="http://www.reelseo.com/youtube-hd-update/" target="_blank">Reel SEO figured it out</a>, but using his example code I wasn't able to get it to work (and neither was Vinny over at <a href="http://www.applethoughts.com" target="_blank">Apple Thoughts</a>). So I thought I'd work backwards - first, I took a look at <a href="http://ca.youtube.com/watch?v=PKr6sZ3zfLY" target="_blank">one of my videos on YouTube</a>, and copied the embed code that YouTube provided. They don't provide a 600 pixel-wide option, so I manually changed that part of the code to be 600px by 365px. The important part is the YouTube video URL in the code.</p><p>In the code below, wherever I saw this:</p><p><strong>http://www.youtube.com/v/PKr6sZ3zfLY</strong></p><p>I added <strong>&amp;fmt=22</strong> onto the end of it, so in the code it looks like this when pasted in:</p><p><strong>http://www.youtube.com/v/PKr6sZ3zfLY&amp;fmt=22</strong></p><p>Or, more accurately, it looks like this when strung together with the other code that YouTube puts in there:</p><p><strong>http://www.youtube.com/v/PKr6sZ3zfLY&amp;fmt=22&amp;hl=en&amp;fs=1&amp;rel=0</strong></p><p>The important thing is that <strong>&amp;fmt=22 </strong>is included immediately after the last character of the YouTube video ID. The results look like this:</p><p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="365" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/PKr6sZ3zfLY&amp;fmt=22&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="600" height="365" src="http://www.youtube.com/v/PKr6sZ3zfLY&amp;fmt=22&amp;hl=en&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><p><strong>UPDATE:</strong> Upon further testing, I'm not convinced that Reel SEO has this figured out after all (or me for that matter). When the video plays, I see an "HQ" option in the lower right corner...so I think this is only streaming the HQ version, which looks good, but isn't the same as HD. I see the same HQ over on the Reel SEO sample video, so I think neither of us is actually embedding the HD stream from YouTube. Back to the drawing board!</p>

EscapePod
01-31-2009, 11:44 PM
A similar article at Download Squad gave the same codes, except they identified it as being for High Quality.

http://www.downloadsquad.com/2008/11/15/how-to-embed-high-quality-youtube-videos/

icatar
02-03-2009, 06:15 AM
Check out this link:
http://www.mydigitallife.info/2008/11/20/how-to-embed-and-play-720p-hd-high-definition-youtube-videos-fmt22-code-hack/

This one adds <b>&ap=%2526fmt%3D22</b> to the URL and seems to have worked for me.

Jason Dunn
02-03-2009, 09:23 PM
This one adds &ap=%2526fmt%3D22 to the URL and seems to have worked for me.

I checked that out, copied his code, and tried it over on my blog - and the YouTube video says "HQ" when it starts playing.

Check it out for yourself:

http://www.jasondunn.com/dancing-matt-2008-1364

So is YouTube dishing out the HD version but putting HQ on it? Or is it really just HQ? :confused:

EscapePod
02-03-2009, 10:31 PM
After a few adjustments to my PC, I'd vote for your sample as being HD. And even more important ... that was the most entertaining video I've ever seen from YouTube. Thanks for posting the link.

Jason Dunn
02-03-2009, 10:43 PM
After a few adjustments to my PC, I'd vote for your sample as being HD.

Interesting...so maybe that really is HD (it DOES look quote good to my eyes). What ticks me off is that if YouTube wasn't so FRAKING obtuse and obscure about this stuff, we'd have our answers. They drive me nuts sometimes! :mad:

And even more important ... that was the most entertaining video I've ever seen from YouTube. Thanks for posting the link.

I'm glad I could brighten your day by posting that. :)

icatar
02-04-2009, 05:20 PM
I checked that out, copied his code, and tried it over on my blog - and the YouTube video says "HQ" when it starts playing.

Check it out for yourself:

http://www.jasondunn.com/dancing-matt-2008-1364

So is YouTube dishing out the HD version but putting HQ on it? Or is it really just HQ? :confused:

I think that is the HD version, it does look pretty good. I believe the "HQ" is just something they have hardcoded into their player since they didn't plan on being able to embed HD at this time. What you can do is embed the HQ and HD versions side by side and we can compare them.