
In this tutorial I am going to show you how to optimize video so you can upload it to YouTube for streaming playback in HD. Because we are in a day and age where broadband speeds are constantly increasing, and media is all becoming high definition, this tutorial will give you a simple way of taking 1080p source material and making it YouTube / XBOX 360 friendly. This tutorial will give you results that will save time on uploading, storage on your HDD, play efficiently and still look great.
You may well be asking why bother using 1080p source if we are going to downsample it to 720p? Well naturally when we plan to re-encode any video it is best to have the best source possible. From this image here you can see the difference in size from 720 to 1080 and you will most likely always get better results encoding 1080p source to 720p than simply 720p to 720p.
Anyway for this tutorial I am going to use The Dark Knight Trailer 3 1080p as the source material which has a resolution of 1920 by 816, 10.6Mbps bitrate and 23.976 fps. The reason I chose this trailer was because it is a good example because you have to add black margins to the video. I tried uploading a widescreen trailer awhile back on YouTube and it would not give me the HD option because it was 1280 by 544 resolution and not 1280 by 720 so only a high quality version was available to viewers. Hence this tutorial.
If you would like to go along step-by-step with me, you can download the same trailer here. Or you can just use a high definition 1080p video of your own choosing, game and movie trailers are a great source to practice on, this tutorial will also be great for home movies captured from HD camcorders.

To complete this tutorial you will have to download a few programs. Apple Quicktime is the first, some high definition videos have 6 channel audio and quicktime can easily export the audio into an MP4 container, with the correct 2 channel AAC (Low Complexity) audio which is needed for youtube, and this can be done in a matter of seconds.
The next program is MeGUI this will be our encoding program. Additional things you will need for MeGUI, the first being x264, download the .exe and this should be put in the main MeGUI directory. Then the x264 DXVA-HD Balanced pre-defined template which you can get here. This preset should be placed in megui / allprofiles / x264 / folder.
Download and install AviSynth 2.5, this will be our script editor where we feed information and specifications through to MeGUI when we start encoding our video file.
The last program is Yamb, this will be our muxer, we will be placing the video and audio inside an MP4 container. You can either download the .exe or simply download the zip archive. Put this anywhere on your computer, then download MP4Box which is a nice companion for Yamb and should be placed in the same folder as Yamb. Now that is all our software, lets get on with the tutorial.

Step 1) Demuxing our Audio.
Firstly once we have our video, we need to split the audio. You simply open your video in Quicktime click File > Export (CTRL+E) and then select 'export to MPEG-4', click options. Video format is what tab you should be on now, change it to 'None' or 'Pass Through' (Screenshot). Then click the drop-down menu and select audio, make sure it is AAC-LC (Music), 320/128 Kbps, stereo, 44.100 KHz and encoding quality should be selected at 'best', press ok and then save, this will the bring up the export window. (Screenshot)
Step 2) Work on our AviSynth script ready for encoding.
Open up MeGUI, on the first drop down menu of the input tab find and select our downloaded template. It should be something like x264: DXVA-HD-Balanced. Once that is done, click on options and settings (CTRL+S), click on program paths. Under the video tab make sure x264 has its correct path, then go along to muxer tab and make sure MP4Box is under the correct folder directory, then finally click the others tab and make sure AviSynth Plugins is correct.
Once you have checked all these save the settings, you should then return to the main interface. Click on Tools > AVS Script Editor (CTRL+R), load your video you downloaded as the video input. The video window will then open, under the play button at the bottom you should see a minus (-) sign, click it to reduce the window. (Screenshot)
Go back to the script editor, on the bottom half you should see the resolution crop block, click the resize radio button, and in the first box replace 1920 with 1280 and then check the radio button across from that which says 'suggest resolution (mod 16)' (Screenshot) this will then select the best appropriate height for the video, depending on the video's original aspect ratio.
If it says 720, then carry on to to the third paragraph after this one. If the entry does not say 720, then you will have to add black margins to the top and bottom, otherwise the youtube uploader will reject it and you will end up with simply a high quality version. Use your brain (or calculator) and put in 720 minus (-) the entry that you currently have in the height box, so say it is 544 then that means you are 176 pixels short, 88 on top and 88 on the bottom, remember this.
Move on to the filters tab first, 'source type' should be progressive, below that you will have a block saying 'Filters', where it says 'Resize Filter' select from the dropdown menu one of the following in these fields: Bicubic, Lanczos or Spline, the option is yours. (Screenshot)
To add the black margins we spoke of earlier to get to 720 pixels in height, simply go from the filters tab you are currently on to the edit tab which is next to it. This is the AVS script we are creating in text format.
All you have to do is put some parameters under where it says #crop. This is the code you should enter first Crop(0, 0, 0, 0) directly under '#Crop' then you will see some text like this on the next line 'BicubicResize(1280,544,0,0.5) # Bicubic (Neutral)', it may not be exactly like that, but after that text on a seperate line, type or copy and paste AddBorders(0, 88, 0, 88) (Screenshot) where the numbers 88 are, that is the top and bottom, you simply add whatever pixels in there which make up to 720 pixels in height that you are missing from the top and bottom of the video.
Here are some common values you may come across, these values are the height of the video and the AddBorders parameter underneath is what you must enter to get the 720 pixel height.
Quote
• 528
AddBorders(0, 96, 0, 96)
• 544
AddBorders(0, 88, 0, 88)
• 608
AddBorders(0, 56, 0, 56)
• 688
AddBorders(0, 16, 0, 16)
• 704
AddBorders(0, 8, 0, 8)
Then save the script, when it is saved, you will return to the main interface, enter a custom filename in the video output bar, I usually rename it to encode.mp4, and on the side of encoder settings hit config and alter the bitrate value (Screenshot). I usually take the bitrate of the 1080p original file and divide it by 3 (MediaInfo), then use that as a 4 digit number which will become the bitrate (Screenshot). Even at an average of 3000 Kbps the video turns out great and you are looking at about 50-60MB on average for a 2 minute 30 second trailer.
Press ok once your custom bitrate value is entered, then press Enqueue on the 'Video encoding' block, go to the 'Queue' tab and press start (Screenshot). This process should take about 5 minutes, depending on your PC. I always set the priority on 'Above Normal'.
Step 3) Muxing our video and audio together, then uploading.
Once your video has been encoded, open up Yamb. On the left menu down the side, hit settings, double click 'advanced settings' make sure the location of MP4Box is correct and then press next to go back to the start.
Click on the creation tab in the top left, double click 'Click to create an MP4 file with multiple audio, video, subtitle and chapter streams.' (Screenshot). Click on the add button, locate and add your MP4 video file first, then the MP4 audio file. Click on the browse button in the output bar at the bottom, rename your output file, choose a folder, click next and you are done. (Screenshot) This will then mux your video and audio together into an .MP4. The only thing left to do is upload your video to youtube and then let people enjoy watching the video in HD.
And the below link is our finished video. This tutorial may seem a lot of writing, but once you do this a few times you can have game, movie and even home videos converted and uploading within 10 minutes.
Sign In
Register
Help








Back to top
MultiQuote

