Wednesday, July 30, 2008

How to make high quality youtube video and embed them

The steps is based on the findings in this video. If you need step by step instructions, play it, otherwise read my post that follows.


It's well known that you can link to the high quality version. If the url of the video is http://www.youtube.com/watch?v=hLtTNE61iik, the video of the HQ version is at http://www.youtube.com/watch?v=hLtTNE61iik&fmt=18

To embed is slightly different. The code to append to the url on the embed codes is
&ap=%2526fmt%3D18. Note that the url appears twice in the embed codes.

To ensure you have the HQ version, you need to do a few things.

Size: it must be 480x360 or above. If you have 4:3, the maximum dimension is 640x480. If you have wide screen 16:9, you can just use 640x360 without letter boxing yourself.

Frame rate: 24 fps works (vimeo uses), PAL is 25 and NTSC is 29.97. 30 fps will work too. Use 24 min.

Video codec: youtube said Divx or Xvid. Actually H.264 will work too. The trick is to configure the codec to use CBR (constant bit rate) and force the bit rate to over 1000 kbps.

File format: avi or mp4 will work (mov and wmv should do too). Strictly speaking H.264 and mp4 is the "real" mpeg4 standard.

Audio: MP3 and AAC will do. AAC is the "real" mpeg4 standard.

Free software is either Avidemux for mp4 compliance, or VirtualDub for popularity.

Avidemux: choose x264 for video AAC for audio and mp4 for file format. In the first main option menu, select encoding mode to be Constant Bitrate, and use the default 1500 kb/s. All codecs are built-in. If you want smaller files you can use 2 passes. Avidemux will do it automatically whereas in VirtualDub you have to config the codec twice, as in video above.

VirtualDub: you have to install the Video For Windows codec x264vfw. (Google for the download link.) As the video above suggests, name the output .avi file, select x264 codec. Configure the codec - the first bitrate option is Multipass - 1st pass. This allow us to pick the target bit rate - set as 1000 kb/s or higher. Then save as xxx.avi. For the 2nd pass, configure the codec to use Multipass - N pass, while everything the same. Then save as xxx.avi and overwrite the file in the 2nd pass.

Of course, if you upload to Vimeo instead, you have full 1280x720 resolution, HD 720p resolution, which is as good as 1024p until your TV is bigger than 50" and you sit close to it. (from some reviews)

For any resolution I use Avidemux x264/AAC/MP4. Vimeo is less fussy about the codec configuration. It accepts the default variable bit rate, while Youtube have to be constant bit rate larger than 600 kb/s to differentiate between "high def" and normal def.

6 comments:

Jorge Albán said...

Thanks. It does indeed work... with Youtube. Vimeo seems to have a less Open source codec-friendly policy and it refused to accept the MPEG-4 AVC x264/AAC/MP4 variant produced with Avidemux 2.4.3.

But with your guidelines the Youtube display quality is so much better from the tiny upsampled 320x240 norm that I see no reason for Vimeo other than HD.

J

Anonymous said...

Really? All my uploads to Vimeo are x264/AAC/MP4 using Avidemux (because it's free). Vimeo accepts variable bit rate so the default codec setting will work. I have HD size 1280x720 and at least 640x480.

As for quality, I don't think when you upload 640, you get true 640. Watching the flash video on browser is different from the original. I think Vimeo is slightly better, haven't really compared. But Youtube has a lot more hits than Vimeo for the same video though.

The Player

Josh said...

Thanks for this post... VERY useful and clear, with all the details provided. I was wondering... do you know if there is any way to replace the UGLY, UGLY, terrible quality thumbnail that appears in the video viewport of embedded videos until the user clicks play? the picture is such terribly quality and it looks pitiful. I know I can choose one of three other images from the video on YouTube, but I mean replacing with a static color or my own jpeg of the correct size and quality.

Josh said...

Also -- do you know if I can embed high quality videos like this in the chromeless player?

The Player said...

The thumbnail I have no idea. The chromeless player I think you mean the customized player. You change the fmt to whatever your customized code is. Note, the fmt isn't official so your vid may later not available.

Anonymous said...

simply use any of the methods mentioned here http://dexterbaker.vox.com/library/post/the-problem-with-downloading-videos-from-youtube.html