Search public documentation:
UE3 Home > Matinee & Cinematics > Capturing Cinematics and Gameplay
UE3 Home > Cinematic Artist > Capturing Cinematics and Gameplay
UE3 Home > Cinematic Artist > Capturing Cinematics and Gameplay
An important aspect in the game development process that often goes overlooked is the ability to capture in-game footage to be used in promoting your game the public, as pre-recorded cinematics played as videos in-game to provide a consistent playback experience, or just to show off cool features you have added. Knowing what features are provided by the engine itself, having a solid workflow, and knowing what gotcha's to avoid will make the entire process much smoother and save you both time and headaches along the way. There are a few options available to capture game footage. Which one you choose to go with will ultimately depend on the end use of the video and the resources, both hardware and software, you have at your disposal.
Rendering out individual frames allows you to capture high-quality images regardless of the complexity of the scene being rendered. Unless you have a hardware capturing solution, this is by far the best way to obtain high-quality high-resolution footage for use as promotional videos, trailers, etc. Rendering frames is also a viable solution if your system simply cannot keep up with rendering the scene at an acceptable framerate for capturing. There are drawbacks to this method, however. For one, this method does not allow for capturing the audio along with the video. This means you have to capture the audio separately which can often make syncing up the audio with the video a challenge. It also does not lend itself to capturing live in-game footage of gameplay controlled by the player because it is not rendering in realtime in most cases. Since the engine will take as long as it needs to render each frame out according to the target framerate, it may take several seconds or more to render each frame. This obviously would make trying to control a player in-game impossible. Subsequently, this method is mainly geared toward capturing cinematics and possibly pre-recorded demos.
UDK.exe UDN_FeaturesDemoThe Command Line Arguments that are used in this process are:
- ResX= - Set horizontal resolution for game window.
- ResY= - Set vertical resolution for game window.
- BENCHMARK - Run game at fixed-step in order to process each frame without skipping any frames. This is useful in conjunction with DUMPMOVIE options.
- DUMPMOVIE - Dump rendered frames to files using current resolution of game.
- DUMPMOVIE_TILEDSHOT=X - Similar to "DUMPMOVIE", but captures each frame as a tiled shot for very high resolution frames (files will be very large, try starting with 2)
- NOTEXTURESTREAMING - Disable texture streaming. Highest quality textures are always loaded.
- MAXQUALITYMODE - Forcibly overrides certain system settings to their highest quality regardless of performance impact.
UDK.exe UDN_FeaturesDemo -BENCHMARK -MAXQUALITYMODE -NOTEXTURESTREAMING -DUMPMOVIE -FPS=30 -ResX=1280 -ResY=720You may notice when running the game like this that you get a few unwanted frames at the beginning and ending of the sequence. This is nothing to worry about since they are individual image files. You can simply delete any unwanted files when the rendering is finished. The resulting image files will be located in the Screenshots directory of your game's installation folder, by default. For UDK users, this would be something like:
C:\UDK\UDK-2010-08\UDKGame\ScreenShotsThe output path can be set in the [Core.System] section of the the *Engine.ini. For example, for UDK the UDKEngine.ini has:
ScreenShotPath=..\..\UDKGame\ScreenShotsThat is actually built from the BaseEngine.ini which has the generic version. If you wanted to make a permanent change to the output directory for frames and screenshots, the BaseEngine.ini would be the file to change. For temporary changes, the [YourGame]Engine.ini can be modified. The files will be named MovieFrame*.bmp, where * is a five digit number representing the frame number of that image. Since the files will always be named the same, you should move these images to a new directory as soon as the capture is complete so there is no risk of getting them confused or overwritten. WARNING: This method will require a great deal of free disk space as it deals with uncompressed files. Depending on the length of the sequence to be captured, you could be looking at 10's of GB of image files and video files.
UDK.exe UDN_FeaturesDemo -ResX=320 -ResY=180There are applications, Audacity being one, which can simply capture only the audio from your computer which would be ideal in this situation. However, you can also use a regular screen capture program to record a video file with audio and rip the audio from the resulting video file afterward if need be. We will use Audacity as an example here. First, make sure you have Audacity installed. It can be downloaded here. Once Audacity is installed, run the program. Open the Preferences dialog from the Edit menu and select the Audio I/O tab. Set the Recording Device to point to your speakers, Stereo Mix (Realtek high Definition) in the example, and set the number of Channels to 2 (Stereo). This tells Audacity to record from the sound card in stereo. Then press OK to save the changes. Now just press the button to begin capturing the sound card's audio. A 2-channel audio track in the workspace of Audacity should appear and begin scrolling as it captures the audio. Use the command line from above to begin playing the low-resolution scene to be captured. Press the button after the scene has finished playing to end the audio capture. You should end up with the full captured audio track in the workspace of Audacity. Now, select Export As WAV from the File menu, select a location and filename, and press Save to save the captured audio to a file. here. Once it is installed, run the application. From the File menu, choose Open Video File. In the file dialog that appears, locate and select the first image in the sequence of rendered frames, for this example it is MoveiFrame00003.bmp. Click Open and the entire sequence should be loaded into VirtualDub. You can scrub through the timeline to confirm this is the case. Now, in the Audio menu, select Audio from another file. Find and select the trimmed audio capture file and click Open to load it. You can play back the video in VirtualDub and see that your audio is lining up well with the video at this point. If it isn't you may need to do further editing in Audacity to get it just right. The Audio should already be set to Direct Stream Copy. This means that no compression or anything will be performed. It simply copies the audio from the file into the new saved video file. However, the video will need to use Full processing mode, which it will default to. The compression also defaults to creating an uncompressed video file which is exactly what we want so these settings are all perfect. When you are ready to save the video file, choose Save as AVI from the File menu. Choose a destination and name for the file and click Save. The status window will appear to show you the progress of the conversion. When the process is complete, you can located and play the video file, assuming your PC can handle it since it is uncompressed at this point. You can skip to the Encoding section now if you wish to compress the video to a more manageable size.
Realtime capturing is a quick and efficient method of capturing footage from your game. It does exactly what the name implies: captures the screen as the game runs. When capturing in realtime, there are no limitations as far as being able to control the player while capturing. This method also allows you to capture the audio along with the video so that there are no syncing issues and you only have to make one pass to get both. These benefits often make this a good way to go, assuming your system can handle running the game at the resolution and framerate you desire. Camtasia is a professional screen capturing software that has tons of features. It can do pretty much anything you might want to do as far as capturing footage is concerned. It does come with a fairly hefty price tag, though, so that is something to keep in mind. A free alternative to Camtasia is CamStudio. It is an open source project that is very similar to Camtasia's recorder using an almost identical interface. This is a good alternative when developing a game on a tight budget. As such, this is the software we will focus on when going through the process of capturing footage with screen capturing software. Make sure you have CamStudio installed. You can download it here. Once installed, open CamStudio. In the Region menu, choose Region. This will allow us to specify a region for capturing when we are ready to record. Select Video Options from the Options menu to open the Video Options dialog. The Compressor you choose is up to you. We will leave it on Microsoft Video 1 and turn the Quality all the way up to 100. Under Framerates, set Capture Frames Every to 33 milliseconds and set Playback Rate to 30 frames/second. This should give you a 30 frames per second capture instead of the 200 fps that it defaults to. You may be able to get the Record audio from speakers option to work on your system; however, it seems to have issues with Windows 7 machines so we will use an alternative method to set up the speakers to be used as the microphone instead. Open the Recording devices for sound in Windows. Find your sound device, "Stereo Mix (Realtek High Definition Audio)_ in the example, and select it. If you do not see your sound device listed, right click and make sure Show Disable Devices and Show Disconnected Devices are both enabled. Set the selected sound device as the default. Press the to open the properties dialog for the sound device. Select the listen tab and set Playback through this device to point to your speakers. Click OK and close the dialogs. Back in CamStudio, select Audio Options for Microphone from the Options > Audio Options menu. Set the Audio Capture Device to point to your sound device. Then set the Recording Format to 44.1 kHz, stereo, 16-bit. Make sure Record audio from microphone is selected in the Options menu. CamStudio is now set up and ready to capture. Start up Unreal with the map you want to capture from. Then press the button. Recording will not start until after you have selected a region to record. Click in the very top-left corner of the Unreal viewport and drag down to the bottom-right corner. You can see the size of the region you have selected while dragging. Recording will begin immediately so once the selection is made, you should trigger the cinematic you want to record or begin the gameplay. When you are finished recording you can stop the recording by pressing the button. You will then be asked to choose a filename to save the video to. The video will take a moment to process and then it will open up in the CamStudio player so you can review the capture. If you are not happy with the result, you can perform another capture. Or if you need to edit parts out of the video, you can take the video into a video editing application and edit as necessary. Aja IO board for capturing straight HDMI, which avoids the need for additional video processing.
What format you encode your videos to depends on what the end use of the video will be. One of the most popular formats on the web today is h264 encoded .mp4 videos with AAC encoded audio. This is a good format for a variety of uses and gives a very good ratio of video quality to file size. Also, this format is supported for uploading to Youtube, Vimeo, and other video sharing sites. In general, you will want your video to be 30 frames per second (USA, Canada, and Japan) or 25 frames per second (rest of the world) and you will want to make sure it is de-interlaced. This shouldn't be an issue when capturing or rendering frames, but if you are using footage from a video camera it is important to make sure it is de-interlaced. Data rate of the target video is very important. You have a data rate for the video and a data rate for the audio. The higher the data rate, the better the quality and the larger the resulting file size. Again, this really depends on what the video will be used for in the end and you may want to do some testing with short videos until you have some values you are happy with. Some suggestions for data rates from Vimeo's Compression Guidelines are:
|SD (640x480)||2000 kbps||320 kbps / 44.100 kHz|
|SD (863x480)||3000 kbps||320 kbps / 44.100 kHz|
|HD (1280x720)||5000 kbps||320 kbps / 44.100 kHz|
- Target Size - Handbrake will attempt to encode the video so that the result will be near that number of MB. The lower the value, the worse the video quality will be.
- Avg Bitrate - Handbrake will encode the video using the bitrate entered. The higher the value, the better the quality and the larger the filesize. This will result on a constant bitrate in the encoded video.
- Constant Quality - Handbrake will adjust the bitrate to ensure the desired quality level chosen. The higher the quality, the larger the file in general. This will result in a variable bitratein teh encoded video.