Site hosted by Angelfire.com: Build your free website today!



If you're not encoding a run for Starcraft, then follow the guides in the SDA Knowledge Base.



Ballofsnow's Starcraft Encoding Guide
v2.3 - July 15, 2006

  1. Introduction
  2. Files you'll need
  3. Installation
  4. Creating the avisynth script
  5. Importing the avisynth script
  6. Setting the video compression
  7. Setting the audio compression
  8. Encoding your run
  9. Advanced: automated encoding with batch files
  10. Multiplexing the finished video and audio files
  11. Submitting
 Introduction.

This guide is to learn how to encode your Starcraft runs in the new format SDA is using. We will be using the H.264 video codec along with the AAC audio codec muxed inside an mp4 container. This is not a guide for avi files, though I still suggest keeping VirtualDubMod around.

We will be making the video files Quicktime 7 compatible and I will provide profiles you can use, or you can just look at the pictures and save your own profiles. I will check your videos to see if they can play in Quicktime 7. If they do not, you'll have to start over and re-submit, so check your work!

For the High Quality (HQ) version we will be using constant quantizer mode with a value of 19 instead of the usual 2-pass 2mbps that SDA uses. This is because Starcraft compresses very well and you're not likely to hit the full 2 mbps. SDA uses 19 as a minimum quantizer for videos with a 640x480 resolution. If you're wondering why I chose not to use constant quality mode, well since we have plenty of bitrate available, why not have each frame be the same quality?

For the Medium Quality (MQ) version we will be using automated 2-pass in Megui to hit either an average bitrate of 512 kbps OR a quantizer of 17. SDA uses 17 as a minimum quantizer for videos with a 320x240 resolution. This is easily done by setting the minimum quantizer to 17. The effect will be that if you have a very low action run, we won't waste bits to reach 512 kbps, the quality of CQ17 is quite enough.

* If you notice that MQ rarely reaches 512 kbp/s, then there's no point doing 2 passes. Just use the MQ 1-pass profile.

SDA still requires an extra DivX/Xvid version for MQ, and I offer to encode it for you as long as you follow this guide. This is because the quality will be so good that encoding MQ off of it won't have an impact on quality. If you go off and do your own DivX/Xvid HQ encode, you'll have to submit DivX/Xvid MQ, too.

 Files you'll need.

-
Avisynth v2.5.6a
- WarpSharp YV12
- Megui
- Video and audio profiles

If Megui is giving you problems with not being able to download neroaacenc, just download it here and extract to program files\Megui\tools\neroaacenc\ and NOT neroaacenc\win32\ or some other folder.
- Nero Digital Audio

 Installation.

- Install Avisynth.
- Extract WarpSharp.dll from warpsharp_25_dll_20030103.zip into the avisynth\plugins folder. I suggest extracting the readme, too. Rename it so it won't get copied over by another file.
- Install Megui, then run it and use the autoupdate feature to get everything else you need. You can update any time you want by going to tools -> update. If for some reason there is no update feature, you got one of the older versions of Megui and need to find one that does have it.

.

- Unpack the video and audio profiles into their respective folders in the megui\profiles\ directory.

 Creating the avisynth script.

Create a text file in the directory with your run. Rename the file extension from .txt to .avs and open that in a text editor like Notepad. I suggest making separate avisynth scripts for each video you make, so for HQ and MQ of one run, have two scripts. Use the following scripts or something similar:


###### High Quality version ######
### SOURCE - Add as many parts as you want. The ++ is shorthand for alignedsplice which will keep your audio in sync.
# Fraps source
#avisource("part1.avi")++avisource("part2.avi")
# Camtasia source - if avisource doesn't work.
directshowsource("part1.avi")

##### Convert to YV12 colorspace so Megui has no problem loading the avisynth file.
ConvertToYV12()

##### Trim - the numbers inside the brackets are the frames you want to keep.
#Trim(0,30000)
#Trim(0,4000)++Trim(4500,30000)


###### Medium Quality version ######
### Load sharpen plugin
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")

### SOURCE - Add as many parts as you want. The ++ is shorthand for alignedsplice which will keep your audio in sync.
# Fraps source
#avisource("part1.avi")++avisource("part2.avi")
# Camtasia source - if avisource doesn't work.
directshowsource("part1.avi")

##### Convert to YV12 colorspace so Megui has no problem loading the avisynth file.
ConvertToYV12()

##### Resize
lanczos4resize(320,240)

##### Sharpen - The default is 30,40. I like 35,40.
XSharpen(35,40)

##### Trim - the numbers inside the brackets are the frames you want to keep.
#Trim(0,30000)
#Trim(0,4000)++Trim(4500,30000)


Edit them accordingly and save the files.

 Importing the avisynth script.

In the input tab, open the avisynth script in both video and audio boxes. You will notice that the output files have the same name...

MAKE SURE THEY ARE DIFFERENT

or you will probably end up losing your whole encode, and a whole lot of time.

Your input screen should look something like this:



 Setting the video compression.

If you have the Starcraft video profiles in the proper directory, you should see it in the pulldown box in the main input screen like the picture above.

If not, click on the config button and use the settings in the pictures here. Click to enlarge.

   

If you have a dual-core computer, set the number of threads to 2.

To save your settings in a profile like I did, just click new at the bottom and type in the name.

Click ok.

 Setting the audio compression.

You should be back to the main input screen. With ND AAC chosen as the codec, choose your profile or click config. My recommended settings:

   

As you can see, there's no difference except the bitrates. Still, it's easier to just select a profile in the main input screen.

 Encoding your run.

So you're back at the input screen, your configs are all good to go. Now you just have to put those encoding jobs in the queue, so click the enqueue button for both video and audio and then click on the queue tab.



Can you guess what to do next? That's right, hit the start button and enjoy watching the grass grow.

 Advanced: automated encoding with batch files.

This section explains how to use batch files to encode your runs with less tediousness than Megui. It will take your avisynth scripts and encode them with the same settings as the ones in the profiles I provided. It will also automatically mux the video and audio streams together.

Setup:
- Choose a folder where you will do all your operations.
- Place x264.exe, neroaacenc.exe, mp4box.exe,
bepipe.exe, batch files and your avisynth scripts in this folder. You can find these in the megui\tools\ directory.

Open encode.bat in notepad or similar text editor. You should see the following lines:
call   1passMQ.bat   Starcraft_P05_043_MQ   1
call   1passHQ.bat   Starcraft_P05_043_HQ   1
1passMQ/HQ will be used more often than 2passMQ/HQ. If you want to be sure that MQ and HQ don't go above 512/2048 kbps then go ahead and use the 2pass batch files.

The next part is the name of your avisynth file without the avs extension. This is the only thing you must change in any of the batch files.

The 1 at the end determines whether or not the intermediate video and audio files will be deleted after they have been muxed together. If you want to keep them, set it to 0, or just leave it blank.

Encoding:
Either run encode.bat or runatlow.bat to encode your videos. I highly suggest running runatlow.bat. This will run encode.bat in low priority mode like Megui does. What is low priority mode you ask? It will simply let you run other things while the encoding is taking place without computer lag, though I don't suggest playing cpu intensive games...

Skip the next section.

 Multiplexing the finished video and audio files.

Simple enough, just go to tools -> muxer -> mp4 muxer and add your video and audio files and set an output file name.



Press the queue button, go to the queue tab and press start again.

Congrats, you're done! ...almost....

 Submitting.

To submit this to SDA, you will go through me. Send me a private message with a link to the file, your full real name, and comments on the run.

DO NOT USE FILEFRONT!

I don't feel like explaining why, just know that it is a horrible, horrible file service. I will NOT accept videos uploaded on this site. Use yousendit.com or rapidshare.de, though with rapidshare you may have to use winrar to split your files to get around the max 100 mb limit.


v2.3 - July 15, 2006
- Reworded parts of the advanced section

v2.2 - July 2, 2006
- Added table of contents.
- Advanced section

v2.1 - June 29, 2006
- Made some sections more clear.

v2.0 - June 25, 2006
- MQ 1-pass profile added.
- Min quantizers changed to 19/17.

v1.9 - June 9, 2006
- Added XSharpen plugin for MQ videos.
- Script section has both HQ and MQ, including Xsharpen.
- HQ profile used in MQ (optional) since CQ20 rarely reaches 512 kbps.

v1.8 - June 4, 2006
- Installation instructions for Megui.