VideoLookAtCamera#
Creates a video object for saving mp4 videos from model simulations.
#include "<AMMR_TOOLS>\ModelUtilities/Video/VideoLookAtCamera.any"`
#VideoLookAtCamera#
Class creating a video camera for video recording of AnyBody simulations.
Usage
Once the model is loaded run Create_Video
operation to create the
Video. The video will be saved in the same folder as the main file.
#include "<ANYBODY_PATH_MODELUTILS>/Video/VideoLookAtCamera.any"
// This is a simple example of using the camera class to create videos.
VideoLookAtCamera MyCam (UP_DIRECTION = y) =
{
// The point the camera focus on
CameraLookAtPoint = Main.MyModel.Femur.Knee.r;
// The vertical field of view in meters at the LookAtPoint
CameraFieldOfView = 1;
// The direction which the camera is placed
// (In global coordinates with respect to the LookAtPoint)
CameraDirection = {1, 1, -1};
// The operations which should be included in the video.
Analysis = {
AnyOperation &ref = Main.MyStudy.InverseDynamics;
};
};
Full signature
VideoLookAtCamera <ObjectName>(
UP_DIRECTION=y,
CREATE_GIF=0,
ENABLE_OVERLAY=1,
) = {};
Arguments
- __CLASS__:
AnyFolder
- UP_DIRECTION:
The direction of the up vector of the camera. (Default: y)
- CREATE_GIF:
If set to 1, a gif will be created in addition to the video. (Default: 0)
- ENABLE_OVERLAY:
If set to 1, the settings used to create the video will be saved in a file. (Default: 1)
Optional initialization members
VideoName = ANYBODY_NAME_MAINFILE;
- class type:
AnyString
File name of the video that will be created
VideoResolution = {1920,1080};
- class type:
AnyIntArray
Video resolution in pixels: Defaults to FullHD Width of the video in pixels
ConstantRateFactor = 30;
- class type:
AnyIntVar
From FFMPEG: The range of the quantizer scale is 0-51: where 0 is lossless, and 51 is worst possible. A lower value is a higher quality.
VideoInputScale = 1;
- class type:
AnyFloat
The ratio between video resolution and input images saved
from anybody. Default is to save images in same resolution as
the output video. It is an advantage to set this to 2 or 4 when
making videos with a low resolution
VideoCodec = "libvpx-vp9";
- class type:
AnyString
The video codec ffmepg will use to create the video. Choose “libxvid” for best for compatibility (eg. with PowerPoint) or “libvpx-vp9” for best performance
VideoStartFrame = 0;
- class type:
AnyInt
This is the start frame used when creating Videos. This can be used to for skipping some of the initial frames.
OverlayImage = _ANYBODY_OVERLAY_LOGO_;
- class type:
AnyString
Image used to overlay (e.g. logo) on the final video
OverlayImageScale = 0.08;
- class type:
AnyVar
Height of the overlay image in percent of the video
VideoPathFFMPEG = _CAMERA_FFMPEG_DEFAULT_PATH_;
- class type:
AnyStringVar
The path to the ffmpeg binary.
VideoInputFrameRate = 24;
- class type:
AnyIntVar
Determines the speed of the video. Setting it to nStep/(tEnd-tStart) make the video run in real time.
VideoOutputFrameRate = 24;
- class type:
AnyIntVar
Video output framerate.
VideoOutputPath = _CAMERA_MAIN_FILE_DIRECTORY_;
- class type:
AnyStringVar
The output path where the video is saved
CameraLookAtPoint = DesignVar({0,1,0});
- class type:
AnyVec3
The point the camera focus on
CameraDistance = DesignVar(6);
- class type:
AnyVar
The distance from the camera to the scene. This does NOT determine the size of scene, since Perspective is off by default. To zoom in/out, use CameraFeildOfView.
CameraFieldOfView = DesignVar(2);
- class type:
AnyVar
The vertical field of view in meters at the LookAtPoint
BackgroundColor = DesignVar({1,1,1});
- class type:
AnyVec3
The background color used for the video
Counter = Camera.Recorder.Counter;
- class type:
AnyInt
Counter for numbering the saved images. This defaults to the camera class builtin counter.
GifResolution = {min({VideoResolution[0],600}),min({VideoResolution[1],600})};
- class type:
AnyIntArray
The resolution used when converting the video to a gif file. By default it will follow video resolution up until 600x600.
GifOutputFrameRate = VideoOutputFrameRate;
- class type:
AnyIntVar
Video output framerate.