Insight3D can record videos, either as a video file or as individual frames as separate image files.
The CameraVideoRecording type records WMV videos. An instance of this type can be obtained from the Camera.VideoRecording (get) property. To begin recording, call the startRecording-java.lang.String-int-int- method. Each time the scene is rendered, such as through animation or by moving the mouse, a frame is sent to the WMV file.
This method takes the filename to save to, as well as 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.
The video frame rate is in frames per second and is independent of the frame rate 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:
CameraVideoRecording recording = getScene().getCamera().getVideoRecording(); recording.startRecording(directory, wmvFilename, CameraVideoFormat.WMV, 5000, 30); // ... recording.stopRecording();
The following example records a WMV file while animating:
CameraVideoRecording recording = getScene().getCamera().getVideoRecording(); recording.startRecording(directory, wmvFilename, CameraVideoFormat.H264, 5000, 30); animationPlayForward(); // ... animationPause(); recording.stopRecording();
When making videos with high resolution terrain and imagery Globe Overlays, set PreloadTerrainAndImagery (get / set) to true to ensure the correct resolution terrain and imagery is loaded for each frame in the video.
The startRecording-java.lang.String-int-int- method begins recording a frame stack. With frame stacks, every rendered frame is saved to a separate image file. One 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 code sample demonstrates frame stack recording:
CameraVideoRecording recording = getScene().getCamera().getVideoRecording(); recording.startRecording(frameStackDirectory, frameStackPrefix, CameraSnapshotFileFormat.JPEG, 0, 2); // ... recording.stopRecording();
The frames can be saved in several different image formats, indicated by the CameraSnapshotFileFormat parameter. 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.