Medical Imaging Interaction Toolkit
2024.06.00
Medical Imaging Interaction Toolkit
|
Record the contents of a render window as video using FFmpeg as external command-line application. More...
#include <mitkVideoRecorder.h>
Public Types | |
enum | OutputFormat { OutputFormat::WebM_VP9, OutputFormat::MP4_H264 } |
Public Member Functions | |
VideoRecorder () | |
~VideoRecorder () | |
VideoRecorder (const VideoRecorder &)=delete | |
VideoRecorder & | operator= (const VideoRecorder &)=delete |
fs::path | GetFFmpegPath () const |
void | SetFFmpegPath (const fs::path &path) |
fs::path | GetOutputPath () const |
void | SetOutputPath (const fs::path &path) |
OutputFormat | GetOutputFormat () const |
void | SetOutputFormat (OutputFormat format) |
std::string | GetRenderWindowName () const |
void | SetRenderWindowName (const std::string &renderWindowName) |
int | GetFrameRate () const |
void | SetFrameRate (unsigned int fps) |
void | StartRecording () |
void | RecordFrame () const |
int | StopRecording () |
Static Public Member Functions | |
static std::string | GetFileExtension (OutputFormat format) |
Get the file extension corresponding to the specified video output format. More... | |
Record the contents of a render window as video using FFmpeg as external command-line application.
Before recording, set the render window, the path to FFmpeg, the path to the video output file, its format/codec, and frame rate.
Most settings have decent defaults, e.g., the royalty-free and open VP9 video codec in a WebM container as output format and a frame rate of 30 frames per second.
If not set explicitly, the FFmpeg path and output format are queried from the preferences, if available.
Call StartRecording() to begin a recording session, record each frame with RecordFrame(), and end the recording session with a call to StopRecording(). StopRecording() is a blocking call that may take a long time to return since it calls FFmpeg to encode the recorded frames into a video. Consider calling it from a separate thread.
The VideoRecorder throws an Exception on any error. It is advised to use it within a try/catch block.
Definition at line 40 of file mitkVideoRecorder.h.
|
strong |
Enumerator | |
---|---|
WebM_VP9 | |
MP4_H264 |
Definition at line 43 of file mitkVideoRecorder.h.
mitk::VideoRecorder::VideoRecorder | ( | ) |
mitk::VideoRecorder::~VideoRecorder | ( | ) |
|
delete |
fs::path mitk::VideoRecorder::GetFFmpegPath | ( | ) | const |
|
static |
Get the file extension corresponding to the specified video output format.
int mitk::VideoRecorder::GetFrameRate | ( | ) | const |
OutputFormat mitk::VideoRecorder::GetOutputFormat | ( | ) | const |
fs::path mitk::VideoRecorder::GetOutputPath | ( | ) | const |
std::string mitk::VideoRecorder::GetRenderWindowName | ( | ) | const |
|
delete |
void mitk::VideoRecorder::RecordFrame | ( | ) | const |
void mitk::VideoRecorder::SetFFmpegPath | ( | const fs::path & | path | ) |
void mitk::VideoRecorder::SetFrameRate | ( | unsigned int | fps | ) |
void mitk::VideoRecorder::SetOutputFormat | ( | OutputFormat | format | ) |
void mitk::VideoRecorder::SetOutputPath | ( | const fs::path & | path | ) |
void mitk::VideoRecorder::SetRenderWindowName | ( | const std::string & | renderWindowName | ) |
void mitk::VideoRecorder::StartRecording | ( | ) |
int mitk::VideoRecorder::StopRecording | ( | ) |