Essentials

Profile

Categories

How To Encode High Quality Gameplay Videos

So, you’ve seen all those fancy game videos on YouTube, downloaded WoW videos or other MMO gameplay and enjoyed the high quality ones? Well you can do it too!

I am going to provide a step by step guide for creating high quality, full screen resolution (1680×1050 and above is very possible, although half size should be used on slower computers) videos of any game you wish to apply this guide to really. It is highly recommended to apply this guide to decently powerful systems of a dual core or more.

We will be using MeGui as our main encoding UI and x264 as our codec. AAC will be used for sound. First of all, you will need the following:

Sony Vegas (optional, any video editor will do, except Movie Maker)
Fraps (you need the full version to record more than 30 seconds)
MeGui
NeroAACEnc
AVISynth
Lagarith Lossless Video Codec
Time

Order of Installation

  1. Fraps
  2. AVISynth
  3. Video Editor of choice
  4. Lagarith Lossless Video Codec
  5. MeGui
  6. NeroAACEnc

First Steps: Setting Up

The first things you should do after you download and install all this software is to setup Fraps the way you want it. For most games, it is now very possible to record at full screen with sound at 30fps, with no lag, on a decent computer (Dual Core or above). These are also the suggested settings. Make sure, if possible, that your recording directory is on a different PHYSICAL Hard Disc than the game. This allows for much smoother gameplay while recording. Recording at Half Size is also decent, if you have a weaker machine and it will speed up encoding somewhat because you can choose lower quality settings but will, obviously, look worse than full screen videos.

Then, open your task manager, right click on fraps.exe and click on “Set Affinity”. Make sure that Fraps is running on at least 2 cores, as shown in the following screenshot. Once you start your game, alt+tab out of it, and, if you have a quad core), set it to run on the two cores that Fraps is NOT running on. Otherwise it should already be running on both cores most of the time. This way you get no interference and both  the game and FRAPS can run at maximum efficiency.


How to make sure FRAPS is running on multiple cores.

Now that we have Fraps all set up, let us take a look at MeGui. It comes with a load of different codecs for both video and sound. The first thing you should do when you run it is update (Options -> Update). This will download the newest version of all codecs as well as MeGui core files. Next, you need to add NeroAACEnc to the list of encoders for MeGui so we can encode the game sound (if you want to keep it). Go to Options -> Settings -> Audio and search for where you installed NeroAACEnc. That is it for now, you can close MeGui.

Time to Snip: Editing and Preparing for Encoding

Now that we have MeGui and all the codecs set up, it is time to edit and encode our video. First of all, if you do NOT want to edit the video and simply encode it, skip down to the next step.

This part is really simple. After editing your video to your liking, putting in audio and effects, save your project and head to render. Make sure you select AVI as your file type. As a codec choose Lagarith Lossless Video Codec. Go into the codec configuration and check “Enable Null Frames”, “Use Multithreading” and select “YV12″ as your mode. For audio, makre sure you select the “PCM Uncompressed” codec with 44,100Hz and 16 bit depth. Go ahead and render the file now. This might take a while so go grab a snack or something.

Getting the Footage Ready: AVISynth for Dummies

Now, MeGui can’t take AVI files directly, so you are going to have to feed it an AviSynth script. Since you have now installed AviSynth (if not do it NOW), you can right click anywhere and create a “New AviSynth Script”. Name the script whatever you want and then open it with notepad.

AviSynth is a very powerful tool, but we will only be using simple functions, like adding video. For this, you need to enter the following code into the script and save:

#AddVideo

AVISource(“H:\Name of File.avi”) + AVISource(“H:\Name of File2.avi”)
ConvertToYV12()

As an exmaple, this takes lets say two fraps videos ond drive H and puts them together so MeGui can render them as one movie. If you have edited your movie with an editor and saved it using the lossless codec then you can skip the “ConvertToYV12()” line. You can also add as many files together as you want using the syntax above, but keep in mind that 25ish minute fullscreen movies take 24 hours to encode on my quad core at decent quality settings.

Now, go ahead and start MeGUi. You will see an “AviSynth” line. Search for the script you created and open it. A preview window should open and show you the exact middle of your video. Your files are now loaded into MeGui and are ready to be encoded. Give it a name in the “Video Output” and select the appropriate x264 codec (see section below) and then MP4 as the file format.

Further AviSynth syntax can be found here and here.

The Encoding: Trial, Error and Lots of Time

So, you made it this far. That was the easy bit. Now comes the hard part, encoding the video with a decent quality! Depending on if you recorded full screen or half size will matter greatly here. I am providing presets that I have used to work on my videos. They work for both Half Size and Full Size videos equally well. You can download them here. To import them go to File -> Import Presets in MeGui.

The two video presets are called x264: For Uploading (use for videos you want to upload to YouTube or WeGame etc.) and x264: For Downloading (Use for videos you put on Filefront or elsewhere for people to download and view). I have also provided one sound preset called NeroAAC: Game Sound. While you can use them already as is, I am sure some of you will want to fine tune the encoding. There are a TON of different settings in the x264 configuration, however I am going to explain the most important ones only. If you want to see ALL the different settings and what they do, take a look here.

Bitrate

The bitrate is the general quality measure of your video. For good computer game encodes, in full screen resolutions, you will want a bit rate from 2000-4000. Keep in mind that the higher the bitrate, the higher the filesize will be. You can save space with the right compression settings, but higher bitrate will always make bigger files with the same settings.

Mode

You will generally only want to use “Automatic 2Pass”. This means that the encoder will work over the file twice. The first time it will analyze it in order to be able to save as many bits as possible in scenes with little movement or action. This way you save a lot of space with no real loss to quality.

Constant quality will make sure all the scenes use the same bitrate, however this means a lot of wasted space. Not the best setting for computer game recordings.

1Pass Encoding is not really recommended either, as it means that the file will only be looked over once, foregoing the bonuses of either constant quality or 2Pass. Do not use.

De-Blocking

This is a very important setting, especially when dealing with electronic video. There is no reason to disable this as it provides a substantial quality boost to the video. There are two settings for deblocking: “Deblocking Strength” and “Deblocking Threshold”. Strength determines how strongly a blocky part of the image can be modified. The higher it is, the stronger blocks will be smoothed, but this means that details surrounding blockyness will be smudged. Threshold is the power with which the encoder decides what is blocking and what is actual detail. The stronger it is, the more aggressive the search will be but the more details will be lost because the encoder will not be sure what is blockyness and what is details.
The standard setting for this is 0:0, however for perfect quality material (full screen screen capture for example) you will want to use something like -1:-1 in order to preserve the details of the video. However, if you have recorded in half size, you will want to have something a little stronger along the lines of 1:2 or 1:1. These are just examples however, it varies from video to video.


Screenshot from original material.


SWGEmu with strong deblocking. You can see details becoming smudged.


High quality encoding with weak deblock. Details are saved and the good encoding helps to remove artifacts.


This is WAR with weak De-Blocking.


This is WAR with strong De-Blocking.

As you can see, de-blocking strength is dependent on the game. While in SWGEmu higher de-blocking causes loss of detail and smudging, in WAR, it provides good quality.

M.E Algoritm and Subpixel Refinement

This defines motion vector quality. For the M.E Algorithm “Multi Hex” is generally enough for good quality, but Exhaustive or SATD Exhaustive can be used for high resolution video for quality improvement. SATD is extremely slow and I suggest Exhaustive as the highest you should go.

The Subpixel Refinement should generally stay at “RD Refinement on All Frames” unless encoding time is really an issue as it provides good quality improvement, however slows down the encode.

Keyframe Interval and Min. GOP Size

This varies from video to video according to its framerate. A video with 30fps should have a minimum GOP size of 30 and a keyframe interval of 300. A 60fps video should have 60 minimum and 600 maximum etc.

Number of Reference Frames

This setting determines how many frames can be referenced by P and B frames. In other words, the higher this is, the better the quality will be because of more reference material, but the encode will slow down with each one. The ones set in the provided presets should be sufficient however.


Number of B Frames

B Frames are highly compressed frames that can increase the general quality of a video by storing quality information very effeciently. The ones provided in the presets should be sufficient however eac person can test different settings and see what they feel makes the best quality for them.

Now that you have set up the video encode, go ahead and que it. Do not start the que yet however. We still need to encode the sounds! That’s right. Unlike conventional encoders MeGui takes video and audio separately. We will need to combine them as the final step.

Now, go ahead and open the SAME AviSynth script you made for the video in the audio tab. Use the provided audio preset (Nero AAC: Game Sound, provided in the zip file with the presets linked above). Go ahead and que this too. You can go ahead and start the que now and go to bed. Assuming your video is of decent length, it will take at LEAST overnight to encode.

WARNING: Make sure the output file for your VIDEO and your AUDIO are different! MeGui does NOT check this and WILL overwrite one with the other.


Combining It All

Now that you are done encoding both video and sound you are ready to combine the two into your final video! In MeGui go to Tools -> Muxer -> MP4 Muxer. Set your encoded video and audio and make sure the “No Splitting” option as well as the “Standard” device is selected. Set your final video name and go ahead and que it then start the que.

Congratulations! You have now created a high quality video of a good size! It is ready to upload and share. For downloadable videos I suggest using FileFront, as it allows up to 600GB in size and is relatively fast for DL. If your video is decently encoded it will provide streaming for free as well.

Here are some examples of encoding:

SWGEmu Scene with Low Encoding Options and Strong Deblocking
SWGEmu Scene with High Encoding Options and Weak Deblocking

WAR Scene with Low Encoding Options and Weak Deblocking
WAR Scene with High Encoding Options and Strong Deblocking

As you can see, each game is different when it comes to De-Blocking. You have to try it separately for each to find the optimum.

Here is the same SWGEmu footage encoded with XVID at high settings for comparrison: SWGEmu Xvid

Generally though Xvid has created larger files than x.264. The footage is 1.5 minutes long and is 33MB in x.264 and 40MB in XVID. This means a 25 minute video would be 550MB in x.264 and 666MB in XVID.

Recommended Players

There are two players that I recommend for playing back such videos: VLC and MPC: HC. MPC:HC seems to take better to high bitrate encodes. I suggest following this guide for enabling VMR9 in MPC.

Enjoy!

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free

Shortcuts & Links

Search