Захват видео и аудио
Материал из CryWiki Russia
(Новая страница: «== Capturing Video and Audio== === Overview=== This tutorial explains how to set up the editor (or game) to capture the video as single frames and audio (in stere...»)
Следующая правка →
Версия 19:42, 20 мая 2011
Содержание |
Capturing Video and Audio
Overview
This tutorial explains how to set up the editor (or game) to capture the video as single frames and audio (in stereo or 5.1 surround sound) in a wav file. This material can later be stitched together with any video editing software.
Preparations
The process of capturing video footage requires several commands to be typed into the console, in order to start both media streams. To speed up the process you can create configuration files that will execute all necessary commands at once. This way, you can start and stop the process quite quickly, however, there are some limitations you should be aware of.
To start the recording you need to set up a few things.
Video settings
Frame size
The height and width of the captured frames in the editor is exactly the size of your perspective window. You can easily resize the view size by rescaling the docked windows (like the rollup bar or the console). The size of the frame is displayed in the upper right corner of the perspective window.
In the actual game you can change the resolution of the captured frames by changing the resolution in the options menu, or using the commands
r_height and r_width
We need to set two variables:
r_height N
r_width M
N stands for the frame height and M for the frame width in pixels. The game will automatically switch to the next possible size if the size entered is not available.
Frames per second
The captured frames are all full frames, also called progressive frames.
Define the amount of frames per second you need. A NTSC standard video is approximately 30 frames per seconds, which is a good compromise between quality and file size. A high quality video can have up to 60 frames per second – the difference in quality of higher values is barely noticeable, but will still take up a lot of file space. Motion will not look smooth with less than 24 fps (cinema standard).
Fixed_time_step
To force a fixed frame rate of a certain speed use the command
Fixed_time_step N
Where N specifies time step, which is calculated as follows:
time step = 1 second / amount of frames
Example: 1 second / 30 frames = 0.033333333
0.0166666667 would be 60 frames per second. If you want to record a standard PAL speed video (25 fps), use a value of 0.04.
File format selection
The captured pictures can be of in several different file formats. A good choice for average quality is jpeg format, whereas tga or bmp are better for higher quality, and HDR for pictures in high dynamic range quality.
Capture_file_format
Use the console command
Capture_file_format N
Where N should be replaced with either jpg, bmp, tga or hdr.
File location
The recorded frames will be stored either in the default folder called “CaptureOutput” located in the root folder, or within a custom folder, defined using the following command:
Capture_folder N
Where N should be replaced with the name of your folder (e.g. scene12_take1 )
Be aware that when you start a recording, the captured frames will be placed in the currently defined folder, overwriting any existing files with the same nameFor each new recording you should either create a new folder or move the existing files to another folder to avoid losing any work.
Starting and ending the recording
When everything is setup you can start the recording with the command
_Capture_frames N_
Set N to 1 to start recording, and 0 to stop.
Audio settings
First of all, decide if you need the audio in stereo or 5.1 surround. You will need to change your audio settings in the Windows control panel. Go to “Sounds and Audio Devices” select the Volume tab, click the button “Advanced” and select your choice of output device.
Deactivating the sound system
After loading your level, you will need to deactivate the sound system before you can redirect the sound output to a file. To deactivate it use the command
Sound.DeactivateAudioDevice()
Now, the sound output will be redirected to root folder and saved as a wav file. The sound will not be running in realtime but linked precisely to the set time step. You won’t hear anything after activating the sound again, as long as you record it.
To write the sound use the command
s_OutputConfig N
N should be set to 3 to activate the non-realtime writing of the wav file or 0 to switch it back to the default setting (autodetection). The other settings of this command are not relevant and will be explained in another tutorial.
Reactivating the sound system
To reset the sound system use the following command
Sound.ActivateAudioDevice()
Now a wav file will be created in the root folder of the game. The file will continue recording until the writing is deactivated with the following combination of commands:
Sound.DeactivateAudioDevice()
s_OutputConfig 0
Sound.ActivateAudioDevice()
Note: Although the whole sound system is reset using the above commands, some sounds won’t restart until they are correctly triggered again. This especially applies for looped sounds. To get the correct sounds to play, it is recommended to start the recording of video and sound first, and then enter any area that triggers your looped sounds for your recording.
Creating configuration files
To capture several recordings with the same setting, it may be convenient to set up a configuration file containing the parameters required for recording, to ensure all captured files are of the same format.
A setting config file could look like this:
sys_spec = 4
Fixed_time_step 0.0333333333
Capture_file_format jpg
Capture_folder myrecording
r_width 1280 r_height 800
The command sys_spec = 4 sets the game graphic settings to very high to get the bet look possible.
To speed up the process to start and stop the recording it’s convenient to create two configuration files, one to start and one to stop the video.
To start recording, you need a config file that looks something like this:
Sound.DeactivateAudioDevice()
s_OutputConfig]] 3
Sound.ActivateAudioDevice()
Capture_frames 1
To stop recording, you need a config file that looks something like this:
Capture_frames 0
Sound.DeactivateAudioDevice()
s_OutputConfig 0
Sound.ActivateAudioDevice()
Executing the config files
To activate the config file open the console and type
_Exec N_
while N is the name of the config file.