Embed High Def Video from YouTube
If you have a video blog or post videos on your blog, you have most likely embedded something off of YouTube. Last year, YouTube bumped up the quality of the videos but when you embed a video on your site, it still references the low quality version instead of the available higher quality video. Now, you need to realize that most of the videos on YouTube are still of the lower quality persuasion but newer videos will always have a higher quality version available.
Tricking the embed code to search out the high def version of each video is pretty simple.
Here are two examples.
Low quality:
High quality:
The difference is one little bit of code that is added to the embed code.
Here is the original embed code:
<object width="560" height="345" data="http://www.youtube.com/v/zrSWBvNXTuM&hl=en&fs=1" type="application/x-shockwave-flash"> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="src" value="http://www.youtube.com/v/zrSWBvNXTuM&hl=en&fs=1" /><param name="allowfullscreen" value="true" /> </object> |
And here is the new code:
<object width="560" height="345" data="http://www.youtube.com/v/zrSWBvNXTuM&ap=%2526fmt%3D22&rel=0" type="application/x-shockwave-flash"> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="src" value="http://www.youtube.com/v/zrSWBvNXTuM&ap=%2526fmt%3D22&rel=0" /> <param name="allowfullscreen" value="true" /> </object> |
I have replaced the &hl=en&fs=1 with &ap=%2526fmt%3D22&rel=0. You don’t need to add the &rel=0 part. That only removes the related videos that usually appear at the end.
There is one issue with this hack. The D22 of the code searched for the highest quality version, aka 720p HD. If there is no 720p HD version you will get a “This Video has Been Deleted” message. The only option is to change D22 to D18 so that is searches for the middle quality version, aka 480p SD.
Are you aware if this is a violation of youtube’s terms of service in any way? I noticed that a portion of the videos on sites that embed this way display a message that it has been deleted because of breaking youtube’s tos. I would love to do this, but I am hesitant.
The message that the video has been deleted will only appears if the video you are embedding does not have a high def version. As far as I know, there is no violation of the terms of service by using this code.
Your blog is very interresting for me, i will come back here..
i am so addicted to Youtube. I watch mostly music videos and funny videos on Youtube sometimes i also upload my own funny videos in youtube. `
Thanx for this small code, very usefull. I will use it on my website
Youtube has made it simpler to embed an HD video to a website. Instead of replacing the &hl=en&fs=1 with &ap=%2526fmt%3D22&rel=0 like stated in this article, just add the &hd=1 at the end of it. It would make it “http://www.youtube.com/v/zrSWBvNXTuM&hl=en&fs=1&hd=1″.
HI,I wanna ask a question:
If I want to embed a HQ youtube video,is there any methods?
(Because I tried the methods mentioned in this article and also
tried changing &hl=en&fs=1 to &ap=%2526fmt%3D18 or just adding &hq=1 behind the url,they didn’t work anyway…)
You need to add hd=1 not hq=1.
I’m sorry but it seems doen’t work
You may try this:http://www.youtube.com/watch?v=Omd72UQo9H0
And its embeded code is
It’s already included &hd=1 ,but the movie seems show the 320p not
480p effect,you may try this then you’ll find it.
The embeded code is
Thanks for that – I am such a newbie when it comes to the internet and it never ceases to amaze me how helpful everyone is. Wish I’d gotten into this sooner now!
It won’t be long before all videos are HD.
Hi, I’ve tried this and it doesn’t appear to work anymore. Whether I use the D22 or D18 it still plays at 360p. I have several videos I want to embed that are available in 360p, 480p, and 720p. I want to embed them at 480p. Can anyone tell me how? Doesn’t the hd=1 option default to the highest quality (720p in this case)?
Thanks in advance for any help.
I don’t know if this still works. YouTube has changed some things since I posted this tutorial.