How to encode 720P HD files for Youtube.

Mp3 and AAC can add an audio delay when encoding (by up to 24 frames!) Most video encoders that also encode the audio know the delay and will compensate for it, however encoding with separate applications is not recommended since you wont know the correct delay to trim or pad the audio file with for sync with the video.

If you're using AVIsynth with a DV file, I noticed every time I had any sort of still frame or null frame, I would loose sync with audio, so you may want to try and film "black" on your camera (lens cap on, then record) and place that behind any titles so that you don't have any non-moving parts of your video. Its just a limitation to the free encoder utilities.
In my video I actually had a few short empty spots, to fade it to black (is that what you mean by null?) But I don't think it did anything because I exported the video lossless AVI and the audio lossless, then encoded both with megui and muxed them and got no desyncing issue, but when I uploaded that video to youtube I did get a desync issue (half a second, can barely tell but it bothers me lol)

( I can tell by downloading the youtube vid with a lil trick
javascript:window.location.href = 'http://youtube.com/get_video?video_id=' + swfArgs['video_id'] + "&fmt=22" + "&l=" + swfArgs['l'] + "&sk=" + swfArgs['sk'] + '&t=' + swfArgs['t'];)
when you paste that in the url it downloads the rencoded youtube video. (only in HD)

I also just tried encoding a .wmv in sony vegas of the video and audio, when it was done rendering the audio matched dead on again, but after upload to youtube and HD download it was out of sync by that (grr, half a second) again

Maybe it's like this with all youtube videos, I'm going to try to rerender the lossless with the wave in vegas, but this time include the audio and use the "interleave every frame" (I heard this supposedly keeps the audio on sync) and see if that works :S


edit// Oh and I'm not just comparing by audio tracks in vegas, I can actually see the out of sync parts I've had both videos up and kept playing at one part, when the scene changes the beat hits exactly, on the youtube download / stream page when the scene changes it waits for a bit of motion in the scene then shoots the beat

Oh, and I was wondering if youtube still had that 48khz issue

edit//

Argh, I don't even care anymore lol the out of sync isn't that bad, I measured it to 0.3 of a second in Vegas
http://img14.imageshack.us/img14/7854/02132009181544en4.jpg
that's what it looks like

I tried
making sure the audio and video was exactly same length by filling the end with blank audio, making sure no black spots in video
interleaving the audio to the video
encoding with WMV through vegas, h264 through vegas (both encoded audio with video)

all of them, the sync was perfect, but when uploaded to youtube it did sumfin to it L:(

maybe I should try vimeo out..
 
Last edited:
In my video I actually had a few short empty spots, to fade it to black (is that what you mean by null?) But I don't think it did anything because I exported the video lossless AVI and the audio lossless, then encoded both with megui and muxed them and got no desyncing issue, but when I uploaded that video to youtube I did get a desync issue (half a second, can barely tell but it bothers me lol)

( I can tell by downloading the youtube vid with a lil trick
javascript:window.location.href = 'http://youtube.com/get_video?video_id=' + swfArgs['video_id'] + "&fmt=22" + "&l=" + swfArgs['l'] + "&sk=" + swfArgs['sk'] + '&t=' + swfArgs['t'];)
when you paste that in the url it downloads the rencoded youtube video. (only in HD)

I also just tried encoding a .wmv in sony vegas of the video and audio, when it was done rendering the audio matched dead on again, but after upload to youtube and HD download it was out of sync by that (grr, half a second) again

Maybe it's like this with all youtube videos, I'm going to try to rerender the lossless with the wave in vegas, but this time include the audio and use the "interleave every frame" (I heard this supposedly keeps the audio on sync) and see if that works :S


edit// Oh and I'm not just comparing by audio tracks in vegas, I can actually see the out of sync parts I've had both videos up and kept playing at one part, when the scene changes the beat hits exactly, on the youtube download / stream page when the scene changes it waits for a bit of motion in the scene then shoots the beat

Oh, and I was wondering if youtube still had that 48khz issue

edit//

Argh, I don't even care anymore lol the out of sync isn't that bad, I measured it to 0.3 of a second in Vegas
http://img14.imageshack.us/img14/7854/02132009181544en4.jpg
that's what it looks like

I tried
making sure the audio and video was exactly same length by filling the end with blank audio, making sure no black spots in video
interleaving the audio to the video
encoding with WMV through vegas, h264 through vegas (both encoded audio with video)

all of them, the sync was perfect, but when uploaded to youtube it did sumfin to it L:(

maybe I should try vimeo out..

This sounds like a bug in Youtube's encoder. You might want to post on their forums about their encoders and the utilities you're using.
 
Hey guys. Nice thread here. Quick question though. Do you guys convert from avi to x264? How do you guys do that without losing quality. Thanks
 
Or if i edit in final cut (1080 24f ) XH-A1 how would i encode from there? Is importing the footage ProRes422 better? EIther way where do i go from there?
 
I followed the instructions here using adobe premiere and something weird happens on my video when i watch in hd. Need help please!!

Heres the vid. Look at the beginning.

http://www.youtube.com/watch?v=5q1r001vLeE&fmt=22

It looks like you have frame blending turned on the for clips. Are you doing anything with the speed? That will cause a blurry look to your video. In Adobe Premiere Pro, mouse2 a clip and make sure frame blending does not have a check mark next to it.

In my own expierence, frame blending should be turned off 90% of the time.
 
Or if i edit in final cut (1080 24f ) XH-A1 how would i encode from there? Is importing the footage ProRes422 better? EIther way where do i go from there?

The easiest thing for you to do is to export your video out of Apple Compressor, following the settings in the first post.

You'll still have to deal with Quicktime Gamma shift. Unless you don't care if your footage looks washed out.
 
Last edited:
Higher quality later down the road (HD viewable in 4-12 hours):


  • Frame size 1280x720 (Any bigger and it doesn’t get the HD treatment)
  • x264 encoder (Use programs like Ripbot, Megui, or Handbrake to create these)
  • 2-pass encode
  • HIGH PROFILE @ level 5.1
  • Average bitrate as high as you can go without filesize over 1024mb
  • Audio AAC-LC, Surround sound (if you have a surround sound track) at 640KBPS or do a stereo track at 320 if that's all you have

It i don't see any of these options in compressor though.
 
It i don't see any of these options in compressor though.

I don't have Apple Compressor in front of me but what you'll want to do is make sure you output h.264 video into a .mp4 file with aac audio.

Apple Compressor's settings should allow you to set things like bit rate, and high profile. Not everything will match over, but try to match as many settings as you can.
 
I used the settings for "Instant HD" but youtube still says Processing... not sure what's going on. could it be because i used VBR for the audio instead of ABR?

edit: after processing, the quality was rather shitty compared to the file uploaded by me.
 
Last edited:
I used the settings for "Instant HD" but youtube still says Processing... not sure what's going on. could it be because i used VBR for the audio instead of ABR?

edit: after processing, the quality was rather shi*ty compared to the file uploaded by me.

Youtube can take up to a few hours before the HD version appears. Youtube basically has to encode your video 4-5 times depending on the resoltuion you upload. Here are the versions I know of that are being made every time you upload a video:

*1080p (If original video is 1920x1080)
*720P (If original video is 1280x720 or higher)
*480P (if original video is 640x480 or higher)
*360P (Always made)
*mobile phone (64kbps) I'm not sure of the video dimensions.
 
Last edited:
Yes, I think they've changed it. 2 reasons lead me to believe this:

1. A lot of users are complaining that their HD video uploads are squeezed horizontally. I don't think this was happening earlier.

2. I uploaded a file that had 44.1 kHz (IIRC) audio by "mistake" and it seemed to play fine. I can't check the file right now to confirm the audio frequency as I don't have it here but if that is the case, it could mean that Youtube has fixed the bug you talk about, changing the algorithm for "transcode or not" in the process.

BTW, Thank you for your contributions to this site. Many of your threads and posts have good info in them. Cheers.
 
What tool can i use to analyze the videostreams? I used to use Gspot back in the days. But that is a quite outdated tool.

I hope to find a suitable preset for megui that is not re-encoded by youtube.
 
i just read on doom9 that youtube has changed their site so that every single video is transcoded, no matter what the settings are... as people were abusing it.
 
He is probably right but it doesn't hurt to try some settings. But what codecs do i need to play the latest Youtube videos? None of my mediaplayers can play it.
 
it seems like youtube it converts every time, but i can't be sure.

My test was by downloading a youtube hd file and then uploading it again to see if the new file was identical to the one i uploaded.

It was not the same file. But they were very similar to my understanding. What I noticed was that youtube always remove one frame.

Maybe someone with a greater knowledge could try this test and give a final verdict.

As far as i know youtube always convert their files nowadays. Which means you should try upload a video with a filesize as close to 1GB as possible.
 
Is there any way to upload a HD video but when not played HD it looks decent without pixilation?


Sorry, Youtube mobile quality always looks like crap. You can link people with a &fmt=18 at the end to force the 480P version.

Updated the first post.
 
Last edited:
Back
Top