Preparing HD Videos for YouTube - How To

Friday January 9thMultimedia, Rants/Opinions/Tips, Video Production Category, Posted by: Kevin

YouTube in HDNow that YouTube has made the switch to 720p High Definition videos, everyone has been wanting to put up their best in full quality. But how do you go about preparing a video so that YouTube accepts it as HD and gives the Play in HD option at the bottom of the video?

In this tutorial, I’ll go through step by step on how to convert, prepare, and upload your videos using completely free and open source programs. They contain absolutely no spyware or viruses and the developers of these even encourage people to edit and improve the software.

Here is a video that I did, using the following steps. You can see how great the results are:

So, let’s start with the basics. Let’s say that you just exported a video from Premiere, Vegas, iMovie, Windows Movie Maker, or any other video editing software as a raw AVI. I recommend exporting it as a lossless video format, if your software supports it. If not, I recommend using DV-AVI or MPEG2 at a high bit rate (>10mb/s) as the option to export. It is important to export the very best video quality as possible, because the quality will only get worse as you convert it more. As always, garbage in, garbage out.  It’s now time to get that exported .AVI, .MP4, or .WMV ready to be converted to YouTube’s standards.

As I mentioned in my previous post, YouTube recommends the following settings for your video:

Resolution: 1280 x 720 (16 x 9HD) or 640 x 480 (4:3 SD)*
*Square Pixel Ratio
Frame Rate: Should be the Same As Your Source Video (Such as 29.97fps, 24fps, etc NTSC or 25fps, etc for PAL)
Codec: H.264, MPEG-2 or MPEG-4 preferred.
Audio Codec: MP3 or AAC preferred
Audio Sample Rate: 44.1kHz
Audio Channels: 2 (stereo)

You’ll need to install the following two pieces of software in order to convert your video to match the above specifications. Both are freeware and open source programs:

In addition, if you get an error message when running either of them, you may need Microsoft .NET Framework.

First, install AVI Synth. All you have to do is click on the .exe and install it with the default configuration. Next, install MeGUI. When you first run MeGUI, a window will pop up that says, “New Updates Are Available to Download.” Make sure that you click yes and update it, as bugs are always fixed. Then, restart MeGUI:

meGUI Update

In addition, a list may come up of presets that you can import. I would recommend importing all of the presets (check all of the boxes), as we’ll be using a preset to help us create this video.

Now, before you get angry and think, “Where is the h.264 option at?” let me explain what we’ll be converting to. x264 is simply an open source version of h.264, according to Wikipedia, and it will count as an h264 file when uploaded to YouTube.

Create a Script File:

So now we have to load our movie and create an AVI Synth script. Luckily, MeGUI gives us an easy tool to use to create it. Go to where it says Tools, then click on AVS Script Creator. This will allow you to create a script to make it easy to set up to encode.

MeGUI Tools

Next, go to where it says Video Input and click on the box. Navigate to where your video is and load it up.

After your video is loaded, a preview window will open. Here you can see what your video will look like. If it’s completely artifacted, it means that AVI Synth is not recognizing the codec that you used. (If you’re trying to open an mpg video, use the D2V Creator, under Tools, to open it, hit queue, start it, then the AVI Synth screen should open.) Now, go to where it says resize, and be sure that the height is set to 720. If your video is in 1080p, you’ll probably have to resize it to make it fit down to 720 pixels in height. Remember to always keep the ratio between height and width the same!

You may also have to cut out black boarders by using the crop tool. Just keep the video preview window open as you do this, so that way you can see how much that you need to cut out. You may also have to experiment with the pixel ratio, because on mine it reported the video as PAL instead of NTSC, which created vertical stretching. Just use that video preview window (and make sure the check box is checked for it) to see how it looks as you change the options. This is certainly the most challenging part of it.

AVI Script Creator Tool

Remember, even if your height is different than 1280, YouTube will center your movie appropriately. The idea is to make sure your video is 720 in height. In addition, you can go to the filters tab, and click analysis which will help in determining video specs. After you’re finished, click Save and then if it’s not selected already, on the MeGUI main screen, go to where it says open AVS, and select the file you just made.

Now go to tools once again, and click on Bit Rate Calculator.

MeGUI Bit Rate Calculator

In the bit rate calculator screen, you can configure how large the final file is going to be, based on the time, average bit rate, and amount of frames per second. Just enter in the length of your clip (mine was 1min and 30sec) and click the radio button that says, “Average Bit Rate” and set that anywhere between 2000 kbit/s to 6000 kbit/s, which is good enough for 720p video. It comes down to how large you want your final file to be. For audio I usually just do 320kps. The calculator will estimate how large your final file will be, and with YouTube’s 10min limit, the largest file you’ll create should be under 200MB.

But wait, YouTube allows 1GB file uploads!

Yes, you could set the bit rate higher than that, but do you really want it to take 10 hours to upload? The beauty of the new h.264 codec is how you can get excellent quality for a small file size!

So now click apply in the bit rate calculator and MeGUI will ask if you want to apply this to your video settings. Click yes. Now you should be back on the main MeGUI screen.

Selecting the Video Encoder Settings

There are a lot of settings that can be changed here. But let’s keep it simple. Hopefully you loaded up the profile presets. The one I usually choose is named, “x264 Unrestricted 2 Pass Insane.” This will scan your video twice, insuring that all of the motion is handled properly. In addition, the bit rate should be already in there if you applied it from the bit rate calculator.

However, the insane setting will make it take a long time to convert your video (it took 5 hours for my one and a half minute long clip) which isn’t ideal if you’re in a rush. You could also select the x264 Fast Mode or Balanced Mode if you don’t mind losing a little quality. Just be sure that it does an auto two pass in the options, as shown in the picture, with your bit rate in there.

x264 Encoder Setup

Click OK and you should be back to the MeGUI main screen. Now under the video area where it says file format, select MP4 as your container.

Selecting the Audio Encoder Settings

YouTube accepts both MP3 and AAC. You could use AAC, but it would involve even more steps of installing Nero’s AAC encoder and such. So let’s stick to MP3, which uses the LAME encoder, which is by far the best for MP3s. First, select the audio source, which is just going to be the same as the video you chose in the AVI Synth screen. Then, select LAME MP3 Scratchpad and set it up with 320kbit/s audio - CBR, like I did:

LAME MP3 Encoder Settings

*Note: Sometimes you may need to check Force Decoding via Direct Show if you get an error when encoding it later on!

Add the Project to the Queue:

The queue is like a batch tool. This means you can set up multiple videos, add them to the queue, and then before you go to bed at night you can launch the queue and it will do each video, one at a time until all of them are done. So now let’s add our video to the queue by clicking the Auto Encode button at the bottom. The nice thing about Auto Encode is MeGUI will encode both the video and audio, and mux the two together on its own.

MeGUI Auto Encode

Configure the Automatic Encoding screen so that the container is MP4, and under Size and Bitrate, make the sure the No Target Size (use profile settings) is checked, then click Queue.

Now all that’s left is to go to the Queue tab in the main MeGUI screen, then click Start and MeGUI will process the video and save it to the folder where your original file is (that is if you didn’t change the save location).

MeGUI Queue

You should now have a nice MP4 video file, usually with the file name as Your Video-mux.mp4!

I Can’t Believe My Eyes

The final file size for my example, a 1min 30sec long 720p HD video was 33.5MB, and yet it looks as good as the source file, which was 328MB in size. That’s 10 times smaller! And yet the quality is excellent. Just check it out on YouTube:

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

1 Trackbacks/Pingbacks

  1. Pingback: mts do mp4 hd (x264) - HDforum on February 24, 2010

12 Comments

  1. Cliff
    January 28, 2009

    Please Help. I am having a hard time finding the correct setting to save my files in to use your conversion technique. I am using Adobe Premiere Elements 4 and can’t figure out how to save my file in “as a raw AVI. I recommend exporting it as a lossless video format, if your software supports it”. Do I use share or Tools, Export” then what, I can’t seem to get right file. Thank you.

  2. K. Phil
    January 28, 2009

    Hi Cliff,

    I haven’t used Elements 4.0, but it sounds like you want to use Tools > Export for the video. As for the codec, you could use the MPEG 2 encoder instead of a lossless one. In my video, I ended up exporting it as a high quality MPEG2 video, since the lossless one would have used up too much hard drive space.

    So, in your export options, you want to select the MPEG2 codec. For Elements I believe it’s called Adobe MPeg Encoder. You also want to customize the settings for that video codec. You want to make sure that the resolution of it is the same as the video that you’re working with (for example, if the video you’re editing is 1080p, then you would type in 1920 × 1080), where the larger number is the width. As long as you set the bitrate to 22mbits/s or higher (that’s 22,000kbits/s), the final output video from Elements should look as good as a lossless output.

    In my video, I exported it out as an MPEG2 at 25mb/s. The file size of this exported video was 328MB. After converting it with the tutorial that I wrote here, the final size came out to 33.5MB. That’s 10 times smaller in video size! And yet the quality was just as good as the version that was 10 times larger in size.

    If you run into anymore problems, I’ll be happy to help.

  3. Cliff
    January 28, 2009

    I am unable to get the MeGUI 0.3.1.1011 to work. The last Job in the queue, creating the muxed.mp4 file “error”s every time. As you suggested I am saving my original file in a MPEG2 format and I can preview the file fine within the MeGUI program. I am saving my original file with Adobe premiere elements 4. Format MPEG2, NTSC, 1280×720,29.97 dropframe[fps], Progressive, Quality 4.0: 384 [kbps], 48 khz, 16 bit, stereo, MPEG; CBR, 25.00 [Mbps]. The test file is 43 seconds long and 136,089 KB (xx.mpg). Job 1 creates xx.d2v. Job 2 creates xx Tc0 L2 2ch 48 384 DELAY 0ms.mp3,. Job 3 creates xx Tc0 L2 2ch 48 384 DELAY 0ms.mp2 . Job 4 creates xx.264 and Job 5 “error”s trying to create xx-muxed.mp4. Any ides why it is unable to complete the job? Thanks.Cliff

  4. K. Phil
    January 29, 2009

    Hi Cliff,

    From the look of things, you set up the mpg output perfectly. The problem is probably in a setting in MeGUI.

    From what you described, it sounds like there are 2 audio files being created:

    Job 2 creates xx Tc0 L2 2ch 48 384 DELAY 0ms.mp3
    Job 3 creates xx Tc0 L2 2ch 48 384 DELAY 0ms.mp2

    Did you configure the audio settings correctly? On the Input tab of MeGUI, it should have a .avs file being placed on there under the AviSynth Script. (The AVISynth script is made from the D2V file) which looks like it is made in Job 1.

    And then for the Audio area, it should say Audio Input and then your xx.mpg file should be selected there. The encoder settings should say LAME MP3. Then you want to click AutoEncode, like in the tutorial. You shouldn’t be making any MP2 files at all.

    If you’re still getting the error after looking at the settings, then try this out. Go to where it says Log and click on that Log tab. Then a list of things will appear. You want to click on the “+” button where it says an error happened. Then just copy and paste it in here so that we can see what’s wrong.

    If it’s a lot of stuff, you can write click anywhere in the log. Then hit Save. Then hit Log. It will ask you where you want to save the log. Just select your desktop or any other easy place that you can remember it. Lastly, after it’s been saved, right click on the .Log file and hit Open With. Then select NotePad from the list. Then you can easily copy and paste the entire log in here so that I can see what’s going on.

  5. draireOffipizso
    February 14, 2009

    hallmedia.com - cool sitename man)))

  6. Clyde Simons
    April 16, 2009

    Help! I’ve been loading 1080-HD videos on youtube without issue until recently. Now the same video’s wont load correctly. I’m using a Sony HD AVCHD – HDR - SR1 in the HD mode with produces a M2TS file. I’m able to convert the files to MPEG -2 but I loose all the quality! It seems that youtube recently made some changes and I need a fix. Can you help me find and easy way around this problem? I’m definitely not very good at this!

  7. Tim
    June 9, 2009

    Just want to throw this out there…

    If you want to edit your .mp4 videos using WMM, download Pazera mp4 converter. Convert as an AVI and MAKE SURE the fps is the same as the .mp4 file or else you’ll get choppy video, misaligning with the audio.

    This had me so mad and I was going to sell my HD camera because I figured my computer couldn’t handle it. Just needed to tweak a few things and now it works great.

    Peace in the middle east!

  8. Gobble10
    August 12, 2009

    Thanks, i just uploaded a video, hoping it will be in HD! So, if it’s successful, thank you, and if not i will try again. :P ill keep you posted

  9. Will
    November 1, 2009

    Thanks for the guide, really easy for a newb like me to follow!

  10. Saad
    December 26, 2009

    Hi,

    Thanks for this detailed guide. I’m having one problem though.

    “go to where it says Video Input and click on the box. Navigate to where your video is and load it up.”

    When I do the above, I get a box saying, “Unable to render file. You probably don’t have the correct filters installed.”

    If it’s any help, I also never got a new updates available window or a list of presets to import when I first ran the program. Could you please help me?

    Thank you.

  11. Saad
    December 26, 2009

    Actually, after running it again, I did get the update and import presets options (both of which I did). However, when I try to load my video in the Script Creator screen, I still get the same error: “Unable to render file. You probably don’t have the correct filters installed.”

  12. flux
    February 11, 2010

    Hello saad, did you get ride of the error “Unable to render file. You probably don’t have the correct filters installed.” ?
    I have the same problem. cheers

Leave a comment