Recording Videos

Topic Description
Recording Videos Record videos in the WMV format.
Recording Frame Stacks Save each rendered frame as a separate image file.

Recording Videos

The camera's VideoRecording interface records WMV videos. StartRecording begins the recording process. Each time the scene is rendered, such as through animation or by moving the mouse, a frame is sent to the WMV file.

Aside from the filename to save to, there are two other parameters: video bit rate and the video frame rate. The video bit rate defines the video's bit rate in kilobits per second, i.e. the number of bits each second of video playback uses. A higher bit rate results in better image quality than a lower bit rate, but the higher bit rate file will be larger than the lower bit rate file.

The video frame rate is in frames per second and is independent of the frame rate that you experience with the application. For example, if the video frame rate is set to 30 and the application is rendering 300 frames per second to the WMV file, the WMV file will still play back at 30 frames per second.

The following example shows how to start and stop recording a WMV file.

[C#] Copy Code
IAgStkGraphicsCameraVideoRecording recording = scene.Camera.VideoRecording;
recording.StartRecording(@"c:\videos\test.wmv", 5000, 30);
// ...
recording.StopRecording();

The following example records a WMV file while animating.

[C#] Copy Code
IAgAnimation animationControl = (IAgAnimation)root;
IAgStkGraphicsCameraVideoRecording recording = scene.Camera.VideoRecording;

recording.StartRecording(@"./Data/Temp/test.wmv", 5000, 30);
animationControl.PlayForward();
// ...
animationControl.Pause();
recording.StopRecording();

Tip: When making videos with high resolution globe overlay terrain and imagery, set PreloadTerrainAndImagery to true to ensure the correct resolution terrain and imagery is loaded for each frame in the video.

Recording Frame Stacks

StartRecordingFrameStack begins recording a frame stack. With frame stacks, every rendered frame is saved to a separate image file. You would do this to record each raw uncompressed frame for use in a movie editor where the frames can be edited and output in any movie format at whatever compression.

The following is an example of a frame stack recording.

[C#] Copy Code
IAgStkGraphicsCameraVideoRecording recording = scene.Camera.VideoRecording;
recording.StartRecordingFrameStack(@"c:\framestack", "frame_", AgEStkGraphicsCameraSnapshotFileFormat.eStkGraphicsCameraSnapshotFileFormatJpeg, 0, 2);
// ...
recording.StopRecording();

The frames can be saved in several different image formats. Each filename is made up of a prefix followed by a number defined in the method's input parameters. In the above example, each saved JPG file's name begins with frame_ followed by a 2 digit number beginning with 0. Make sure that the number of frame digits is large enough such that filenames do not repeat and overwrite each other.

STK Engine for UNIX 11.2