Help-Key: How to Optimize Your Video for YouTube
- July 16th, 2007
- Read 19071 times
- 71 Comments
When I say things like this, my friends roll their eyes, but it’s how I actually talk. I say things like, “Let’s talk about video compression!” They buy another drink. But that’s what we’re doing in today’s Help-Key, and it’s something I actually get to do for a living (besides blogging, duh).
YouTube is getting huge. Somehow, despite the lack of a coherent business model, it’s become one of the most popular destinations on the Internet, and rightly so: the idea that anyone can become some sort of memestar by uploading a simple video is great. And because the site does its own Flash conversion, it’s a piece of cake. The thing is, though, with digital video garbage in means garbage out.
You may have noticed that some videos on YouTube simply look better than others. This is because they came from better sources. With a little tweaking and a little know-how, you can prepare your video for YouTube in a way that spares us all from oversized pixels.
The first step is knowing what format you’re starting with. Most digital cameras today shoot video, as do most phones, which is a great cheap way to start. Sadly, the videos created tend to be worse than that 3rd-gen VHS copy of Cheerleader Carwash 8 you found under your brother’s bed. If you can, pull your video from a digital camcorder. Most Mini-DV cameras include Firewire out, so if you’ve got a fairly recent Mac you’re set. Or you can get a Firewire card for your Peecee pretty cheap.
But no matter where your video comes from, the onus is on you to make it awesome. There are plenty of editing tools on the Internet for any platform you wish, and the latest computers actually have tools bundled with the basic install for just such casual editing. And they’re easier to use than you think. You’re not Kubrick, so you don’t need Final Cut Pro or Premiere. I personally use the $30 pro version of Quicktime, because it’s fast and has drag-n-drop editing, which is nice.
If you can avoid it, don’t use the Windows Movie Maker. The program handles things with tricky Windows Media codecs and black magic and the blood of virgins. Also, if you’re using a cellphone video source, it’ll vomit on you. Quicktime plays nice with about anything, and the pro version can be had on any PC or Mac.
Once you’ve got your clip looking pro, you’re going to want to make it YouTube ready. YouTube can only take certain formats for input, so this is where it gets tricky. You’ll want to make a .mov or .mp4, so make sure whatever editor you’re using can hack it. If not, you’ll need to do a conversion, and that’s no rock n’ roll fun, and you lose information during the transition, so best just leave it alone.
Your newly formed video should be set to the YouTube-native size of 320×240 (aka QVGA). I know, I know: here we are in the world of HiDef, and I’m telling you to shrink your vids. I’m just the messenger, ya know?
It’s also worth noting that your camera might shoot at a different aspect ration than the 4:3 that is 320×240. If so, you’ll have to do a little letterboxing. It does king of suck, but it’s better than the stretch and pull method that would happen otherwise.
When YouTube’s servers encode your video, it’s going to lose some quality, it’s a fact of streaming media. That means you’re going to want to make it as bit-rich as you can. Use a bitrate as high as you can, YouTube can take it. That being said, anything above 1200kbps is probably overkill and will take the video longer to process on YouTube’s end. Somewhere between 700kbps and 1000kbps should do the trick nicely.
Now that we’ve got size, codec, and quality set up, choose your audio. You’ll want to use the MP3 audio codec (either CBR of VBR), which should be standard on your editor.
Output your file as a .mov or .mp4 and preview it. It should look pretty good (if small). If you’re satisfied, do your upload. After it’s on the servers, it can take up to an hour or more to display. This is because YouTube is formatting it and encoding it for their Flash streaming. It’s an automated process, but by following the guide above, it makes less work for the YouTube servers. This isn’t altruistic, however: you did some of their work for them, but since you were in control, you made it better than they could. This means that your video will look better than most, and will encode faster. Double bonus, pal.
Test it out and tell us what you think. If you’ve got some other tips, feel free to share them in the comments thread for this story. Also note that there’s software out there that has automated YouTube features, such as VirtualDub. These programs are great time-savers if you’re and hardcore YouTuber, and they should be considered.
Enjoy, readers, and we’ll see you on our screens soon.


ProfessionalGun (Who am I?)
11 months ago
Bravo, Matt - I’d been wondering if there were secrets to quality YouTube compression. Most YouTube videos look like crap, if you ask me - so any advice on how to get it right is the opposite of “king of suck”.
Anonymous
6 months ago
That “king of suck” was a typo.
Reply
Anonymous
11 months ago
Dude, Most “peecee’s” come with firewire, they have for years. Also Windows Media Encoder 9 can do a great job on You Tube.
Reply
Thomas Steiner (Who am I?)
11 months ago
Hi Matt - Thanks for sharing your hints. Together with YouTube’s own quality optimization FAQ (http://www.google.com/support/youtube/bin/answer.py?answer=55745&topic=10526), this blog entry hopefully helps users getting the best out of YouTube. I have written a “HOWTO make a screencast with Mac OS X” tutorial, intuitively I respected most of your hints… http://blog.tomayac.de/index.php?date=2007-07-13&time=11:25:36&perma=HOWTO+make+a+screenc.html.
san (Who am I?)
11 months ago
hi,
when i output my .mov files the files are insanely huge.. like a 1 min video is 51MB. I tried all different settings inside the compressor drop-down.. everything from vfw to h.263(?), etc.. also when I winrar the file it comes down to like 10MB so i’m guessing something is amiss somewhere in the qt compression..
any ideas?
great article btw..
regards,
san
w00kie (Who am I?)
11 months ago
can we get that Untitled 2 video from somewhere? :P
jeradc
11 months ago
I didn’t quite follow why not to use “Windows Movie Maker”.
Reply
Ed (Who am I?)
11 months ago
Definitely with a Mac it’s so much easier. The other thing, you’ll need plenty of disk space so getting big external drives are a must.
Gdude (Who am I?)
11 months ago
What about framerate? 15, 30, or 60fps?
Jeff Caylor (Who am I?)
11 months ago
Nice article. I have one question: I’m confused about the h.264 compression Youtube is using for Apple TV and iPhone videos.
Is this simply a Flash alternative, or will it give better resolution, thus making me wish I had encoded with a larger screen res; higher quality? I’d love to hear your thoughts.
Thanks again,
Jeff
stwrongtone media (Who am I?)
2 months ago
video compression. It is also known as MPEG-4 Part 10, or MPEG-4 AVC (for Advanced Video Coding). It is latest block based motion estimation based codec developed by the ITU-T Video Coding Experts Group (VCEG) together with the ISO/IEC Moving Picture Experts Group (MPEG) as the product of a partnership effort known as the Joint Video Team (JVT). The ITU-T H.264 standard and the ISO/IEC MPEG-4 Part 10 standard (formally, ISO/IEC 14496-10) are jointly maintained so that they have identical technical content. The final drafting work on the first version of the standard was completed in May 2003.
Nate Murray (Who am I?)
11 months ago
Do you have a link to a video on youtube that uses this technique? I would love to see a video that uses it compared to the same video that does not just to see the difference in quality.
andy carvin (Who am I?)
11 months ago
San: are you sure you’re setting it to output video at the right size? 50 megs for one minute of footage is pretty darn huge. Using Quicktime Pro I usually just let it rip, exporting as MP4 and using its recommended settings. Typically I get around 2-5 megs per minute of footage, depending on whether I slide the quality scale up or down.
Gdude: 30 fps looks best when you’re watching a video as quicktime or mp4, but doesn’t youtube autoconvert to 15 fps anyway? So if youtube is your only outlet, there’s nothing wrong with 15 fps. I still prefer to export my videos at 30fps, since I also use blip.tv for posting my video to my video blog. So while Youtube sometimes gives me a bigger audience, the footage served by blip looks more like what I intended. I also can’t think of a reason to use 60fps. The only time I ever use it is when I’m planning to edit something and use a slo-mo effect. Otherwise I always stick to 30fps.
You may also want to check out http://www.freevlog.org. They’ve got some great free tutorials for video bloggers, including compression suggestions.
d (Who am I?)
11 months ago
I use Final Cut 5 and Compressor. I export it as Web Streaming H.264 300kbps and the outcome is good.
Mezza (Who am I?)
11 months ago
On linux, there’s a great tool, ffmpeg. Use it from the commandline:
fmpeg -i input.mov -vcodec mpeg4 -acodec mp3 -s 320×240 -b 1000k output.mp4
it wil convert allmost every input format into allmost every other format..
cheers
Mezza (Who am I?)
11 months ago
ffmpeg in the commandline that is, not fmpeg…
john griffin (Who am I?)
11 months ago
Great write up and is perfect for what I have been researching. I have been writing on good ways to publicize and distribute your videos online but this goes hand in hand with getting a good product (video) out in the market. with this helpful write up that you have outlined above I think that it will add to the attractiveness of the online viewing experience.
john griffin
Frank Fulchiero (Who am I?)
11 months ago
There is another good YouTube encoding tutorial, at LAFCUG. If you want the best quality encode use QuickTime H.264, and upload to blip.tv. They maintain the original QT movie, but also re-encode a second version to Flash. A 400 kbps data rate is usually fine for 320×240, but they also take larger videos, I’m up to 448×336. They generate some nice QT or Flash embed code for blogs also.
MIT has started using blip.tv for their videos. Nothing wrong with YouTube though, it’s got the audience…
Mike Y (Who am I?)
11 months ago
Do these tips hold true for Google Video as well?
Toonerstan (Who am I?)
11 months ago
If you convert your videos to Flash before you upload, you can get considerably better results than uploading them as QuickTime and letting YouTube do the conversion.
Ben (Who am I?)
11 months ago
The only part of this I dont understand is why is he telling people to put mp3 audio into an .mp4 container, this is against spec and will break many players. Best to leave it as AAC.
URL (Who am I?)
11 months ago
You had to get an MS bash in there didn’t you?
Austin (Who am I?)
11 months ago
@Ben: Its because YouTube uses mono mp3 for its audio. Again, you’re doing the work for YouTube.
Elliott Cost (Who am I?)
11 months ago
Great article dude. I’ll have to try this next time I upload to YouTube.
prumyet (Who am I?)
11 months ago
i want to watch music
mgb
11 months ago
great article but one comment:
Why do mac people think PC people don’t have firewire? My PC came with it standard. Every PC I’ve built since 2000 has had at least one firewire port directly in the back of the motherboard.
Reply
What.A.Wookie! (Who am I?)
11 months ago
I agree with the other wookie…got a link to untitled 2
BTW nice article.
drew
11 months ago
I have disagree that mp4 is the way to go , to get clearer video, and Youtube is the way to go to upload….
I use linux and XVID (divx) codec rocks. below is the command i use.
mencoder -ovc xvid -oac mp3 -xvidencopts bitrate=1100 -vf scale=640:400 -o outputclipname.avi youroriginalfile.mpg (or .mov or anything).
see results at brightcove >> http://www.brightcove.com/title.jsp?title=1114268305&channel=1080168798
Reply
Frank Fulchiero (Who am I?)
11 months ago
@Austin, yes YouTube uses mp3, but they re-encode anything you upload, so it gets transcoded anyways. The issue is what format least suffers through the recompression.
Same with flash-encoded uploads, they re-encode anyways. That’s why so much of YouTube video has poor visual quality. (no comment on the content!)
@drew. XVID (divx) is part of the MPEG4 standard, specifically Part 2 Advanced Simple Profile. The above tutorial encodes using Part 2 Simple Profile, which is not considered as efficient.
H.264 is MPEG4 Part 10, which is considered the most efficient. Efficiency meaning attainable quality at specific data rates.
Compression quality can depend more on the implementation (developer) of the specific codec, the software used to encode, and the setting used, than the codec itself. That’s why you see several successful approaches to the same problem. The characteristics of the video (high-motion, lots of chroma, gradients, fine detail, etc.) has a lot to do with the final results.
leo (Who am I?)
11 months ago
So where’s the video with the girl in it?
yum
11 months ago
where’s the chick video?
Reply
Ben
11 months ago
Has anyone experienced this same gray glitch problem when using Quicktime Pro to convert your video for YouTube…
I export the video via QT Pro on my PC using 320×240 QVGA, 30 FPS, 1000bps, H.264. On my local computer, the video looks great. However, whenever I upload the video to YouTube, I get a glitch for the first 5+ seconds where the video is gray (minimal colors). After the 5 seconds, the color all pops into place. It is like YouTube is missing the first frame of data (keyframe) where the first picture (along with all of the color) is set. So the first 5 seconds only shows the difference in each subsequent frame.
Has anyone seen this same problem? Any ideas for a resolution?
Thanks,
Ben
Reply
james (Who am I?)
4 months ago
hey i also encounter the same problem i use final cut express hd and there is a small blip of grey and there is a matte overlayed, :/
Ben (Who am I?)
4 months ago
Ben, what did you discover about the grey screen at the start of your video.? Solution?
Kevio (Who am I?)
11 months ago
I’m surprised nobody mentioned that the footage affects compression and quality. If you shoot with a tripod you are going to get much better compression than if you shoot handheld. This is because the less information that is moving the more the compression algorithm can “freeze” through consecutive frames. More information moving on screen means more data to remember and store. Resulting in larger files and less optimization.
todd (Who am I?)
11 months ago
who owns a mac?
Frank Fulchiero (Who am I?)
11 months ago
@ben, did you try not selecting Frame Reordering, putting in a keyframe every 2 or 3 seconds, and Optimizing for CD ROM when encoding?
@todd…nice troll, but kind of irrelevant to the discussion.
Before this turns into a food fight, you should know that QuickTime and the Pro version generally work just as well on Windows as they do on OSX. Along with many other codecs.
Matt Hickey (Who am I?)
11 months ago
Re: Untitled 2
This is actually just a single clip, much like Untitled next to it, that is currently being edited into a video to appear on YouTube shortly entitled “Hawt Nights: The Erotic Scrapbook of a Gadget Blogger”. It will be uploaded this fall. Watch for it.
Also, @ Kevio: You’re totally right. The tone of this guide, though, wasn’t so much for prosumers but for the “OMG look what sean did! Did you get that on tape!?” crowd, which tend to be handheld-users. You are, though, absolutely correct, and thank you.
BayTaper(Dot)Com (Who am I?)
11 months ago
This article came close, but is missing a few things. For starters, and since YouTube is going to recompress whatever you give it, your goal should be to get the file into the highest res format that they will accept. So, personally, for me this means:
1. Use 640×480 source b/c that gives youtube more resolution to work with when they re-encode down to 320×240. (Alternate opinion: do the resize yourself because you think you have better software to do it, that said, they’ll just re-encode your 320×240 source back to 320×240 again, so why not give them more to work with?).
2. Use the HIGHEST bit rate combination for audio and video that you can and still stay under the 100mb upload per video limit. Again, this allows you to give YouTube the best possible source quality that they will accept, so when they run it through their transcoder, they’re starting with a nice clean source. Some encoders will let you set a target file size, so that is perfect, shoot for 90 mb, and you’re golden. (Alternate perspective: maybe this is overkill, but chances are your original source is MPEG2 or DV quality, so why not tap as much bit rate as they’ll let you. Also, the obvious downside is a longer upload time, but it’ll be worth it, trust me).
3. Frame rate. This one’s tougher. YouTube is going to encode it down to 15 fps no matter what you upload, so you might be better off getting the cleanest 15 fps source you can in a good editor/encoder before uploading. On the other hand, if their encoder is good, you might want to feed it 30 fps so it can interpolate between frames itself with that higher bit rate source and 640×480 resolution.
Anyway, the KEY POINT is that they let you upload 100 mb file, so you should take every advantage of that you can, giving them the highest bit rate source to start with that still meets their upload requirements. Trust me, this one thing alone will do more for end-result quality than any of those tips mentioned above!
MattMTL (Who am I?)
3 months ago
Hi,
I tend to agree with you. Even Youtube recommends 640×480 uploads. Are most recommending 320×240 uploads just to keep long vids under the 100MB mark?
However, I do believe youtube allows 30fps, at least that’s the info displayed on some of the vids I’ve downloaded from them for analysis.
If the goal is to get as close to 100MB as possible then I guess there are two options:
1. 640×480 at a lower bit rate
2. 320×240 at the highest bit rate possible, just below overkill
After youtube encodes, which leaves you with the better quality? I guess that is the question.
Terry Lechecul (Who am I?)
11 months ago
Is QT Pro free?
Nope.
Windows media maker is free and by the way, no problem on this end with it. I have a bootlegged version of Premiere but WMM is very quick and I can see why its popular even though you can do little with it.
Lets see if you can do an article where youre not whoring for Apple or maybe suggest some free programs for the pc. Let me guess, youre a Mac user and dont know any, right?
Its pretty lazy of you to not have ONE single suggestion for software.
If someone had paid for you to write this article they could have asked for their money back.
Unknown
11 months ago
I wouldn’t wipe my ass with your “article” for fear of rubbing some intelligence on it.
Reply
Marketinggal (Who am I?)
11 months ago
Nice article.
Daniel (Who am I?)
11 months ago
As an avid YouTuber, I found your article to be very correct. I receive many requests regarding video “clarity” and I’m glad I can send them to this article instead of retyping an answer all over again.
Thanks!
mark cox (Who am I?)
11 months ago
ffmpeg was mentioned in this thread. a ffmpeg developer discovered that youtube uses ffmpeg internally. If you want the ‘best’ quality, you should convert your video to flv using ffmpeg because when you upload the video it won’t do ANY conversion. Perhaps if the bitrate is too high or something it will re-encode. You can test if the video was modified by uploading it, downloading the flv file and comparing the two files for changes. Then, you can see if youtube re-encodes your flv, but i believe it doesn’t.
http://ffmpeg.mplayerhq.hu/