Link directly to and embed HD YouTube videos
Posted December 16, 2011 by Nick Vogt in Web and Internet
Whenever possible, I always link to and embed HD versions of YouTube videos. I do this primarily for the better 152kbps audio quality. YouTube has made some changes recently that have made it more difficult to link to and embed HD videos, but it's still doable.Link to HD YouTube Videos
Linking directly to a high definition (HD) version of a YouTube video used to be done by adding "&fmt=" and 35, 22, or 37 at the end of the link. This no longer works, but you can still use "&hd=1", which will link to the 720p version of a video, if available. Here is an example of a link with "&hd=1" added to the end of it:
http://www.youtube.com/watch?v=cvt08Tvcyw4&hd=1
The following will also work:
http://www.youtube.com/watch?v=cvt08Tvcyw4&feature=related&hd=1
Thanks to commentor KarDave for pointing out that you can link directly to the popout version of a 1080p video. It won't be in the normal YouTube layout and will be just the video at full browser dimensions. The link is:
http://www.youtube.com/watch_popup?v=VIDEO_ID&vq=hd1080
Replace VIDEO_ID with the ID of the video, naturally. If you leave the &vq=hd1080 out, or the video does not support 1080, it will default to 720 (if available). You can also use 3rd party embedded players to have more control over the playback, but that won't be covered here.
Embed HD YouTube Videos
By default, YouTube's embed code will not allow you to make an embedded video default to a higher quality than its size. For example, even if Play in HD is selected, a 640 x 360 video will default to 360p quality. Here are the example 16 x 9 aspect ratio videos and their respective default qualities when embedded:
| Resolution | Default quality |
|---|---|
| 560 x 315 | 360p |
| 640 x 360 | 360p |
| 853 x 480 | 480p |
| 1280 x 720 | 720p |
YouTube's logic for not letting you default to higher quality resolutions is simply that you shouldn't need to. If the embedded player size is 640 x 360, you shouldn't need a 1280x 720 quality video. Of course that ignores the compression quality and other issues, not the least of which being that audio bitrate is dependent on the video quality you choose.
Old embed code to the rescue
Thankfully, you can still get smaller resolution videos to play in HD (720p if available) by default by using the old embed code and modifying it a little. First, open up the embed dialog on a YouTube video page by clicking on Share, then Embed. Once there, follow the instructions in the image below:

In case the image doesn't work, click Play in HD, then click Use old embed code, then change the resolution to the size you want, then remove the two occurrences of version=3. Or, you can just use this code (change the two occurrences of VIDEO_ID and width/height to your desired values):
<object width="640" height="360">
<param name="movie" value="http://www.youtube.com/v/VIDEO_ID?hl=en_US&rel=0&hd=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/VIDEO_ID?hl=en_US&rel=0&hd=1" type="application/x-shockwave-flash" width="640" height="360" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
<param name="movie" value="http://www.youtube.com/v/VIDEO_ID?hl=en_US&rel=0&hd=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/VIDEO_ID?hl=en_US&rel=0&hd=1" type="application/x-shockwave-flash" width="640" height="360" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
I hope this will allow you to at least embed your videos to playback at 720p by default (if available). For further reading on how the new embed code works, as well as some interesting information on YouTube players, see my post on embedding YouTube videos.
Related articles:
| Tags | youtube how to |
|---|
Comment on this post
Legacy Comments (20)
kiki77@comcast.net | November 17, 2011 | 11:54 PM PST
What KarDave said below works for embedding 1080i.
All you have to do is use his ^ URL structure and embed it with a 3rd party app, such as JWPlayer or WordTube.. or whatever video embedder you're using ;)
All you have to do is use his ^ URL structure and embed it with a 3rd party app, such as JWPlayer or WordTube.. or whatever video embedder you're using ;)
z | November 9, 2011 | 12:36 PM PST
yeah sill not working ;/
GREEK | October 23, 2011 | 3:18 PM PST
popup + 720:
http://www.youtube.com/watch_popup?v=rQDpBkdpE0o&vq=hd720
credits to KarDave
http://www.youtube.com/watch_popup?v=rQDpBkdpE0o&vq=hd720
credits to KarDave
KarDave | October 21, 2011 | 3:32 AM PST
1080p direct link only in popup:
http://www.youtube.com/watch_popup?v=YW8p8JO2hQw&vq=hd1080
http://www.youtube.com/watch_popup?v=YW8p8JO2hQw&vq=hd1080
brunitou | September 21, 2011 | 11:39 AM PST
same question: hd=1 for 720p but ??? for 1080p ??
Rumo | September 2, 2011 | 4:46 AM PST
but it wont' work when posting to FB
Nick | September 2, 2011 | 9:50 AM PST
That is correct. It doesn't matter if you include the "HD=1" part of the link or not, Facebook normalizes the URL and will embed the regular quality unfortunately.
Rumo | September 2, 2011 | 4:36 AM PST
works perfecly, HI 5!
thnx
thnx
marc | July 17, 2011 | 2:00 PM PST
i actually had it working up until a a couple weeks ago. was there any updates? i can't force it to play at HD anymore even after adding the special coding in.
arg.
arg.
Nick | July 17, 2011 | 3:53 PM PST
I just tried it and you're right, I couldn't get it to play in HD by default in an embedded video, unless the resolution was at 1280x750. It must have something to do with their recent update. Darn YouTube!
1080p | April 30, 2011 | 1:27 PM PST
hd=1 only give you 720p what is the code for 1080p?
Nick | April 30, 2011 | 2:19 PM PST
Currently I don't think there is a code to link to 1080p anymore.
A.K. | March 30, 2011 | 7:00 AM PST
It worked!! Awesome, thanks!!
Elliott | March 22, 2011 | 3:04 PM PST
Your posts are great, but you need to setup and RSS feed!
Nick | December 13, 2010 | 10:59 AM PST
It looks like YouTube changed something and this is no longer working. adding "hd=1" at the end still works, though you can't specify exactly what resolution you want anymore. I will update the post to reflect this.
Valiante | December 13, 2010 | 10:53 AM PST
Doesn't appear to work anymore - even copied & pasted the link you posted above. For info I'm using Firefox - don't know whether that makes a difference?
Killer | November 27, 2010 | 12:42 AM PST
Works like a charm. Good stuff, man :)
Boing | November 18, 2010 | 5:55 AM PST
Cool stuff, thanks!
[used it for Crysis2 1080p trailer!]
[used it for Crysis2 1080p trailer!]
H | September 1, 2010 | 9:36 PM PST
nevermind. only one video was being reluctant. thanks for the code.
H | September 1, 2010 | 9:33 PM PST
not working...
