Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkVideoRecorder.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkVideoRecorder_h
14 #define mitkVideoRecorder_h
15 
16 #include <mitkFileSystem.h>
17 #include <memory>
18 #include <string>
19 
20 #include <MitkCoreExports.h>
21 
22 namespace mitk
23 {
41  {
42  public:
43  enum class OutputFormat
44  {
45  WebM_VP9,
46  MP4_H264
47  };
48 
53  static std::string GetFileExtension(OutputFormat format);
54 
57 
58  VideoRecorder(const VideoRecorder&) = delete;
60 
68  fs::path GetFFmpegPath() const;
69 
74  void SetFFmpegPath(const fs::path& path);
75 
80  fs::path GetOutputPath() const;
81 
86  void SetOutputPath(const fs::path& path);
87 
97 
103 
108  std::string GetRenderWindowName() const;
109 
114  void SetRenderWindowName(const std::string& renderWindowName);
115 
120  int GetFrameRate() const;
121 
126  void SetFrameRate(unsigned int fps);
127 
135 
145  void RecordFrame() const;
146 
160 
161  private:
162  class Impl;
163  std::unique_ptr<Impl> m_Impl;
164  };
165 }
166 
167 #endif
#define MITKCORE_EXPORT
Record the contents of a render window as video using FFmpeg as external command-line application.
int StopRecording()
Stop the recording session and encode the video.
void SetFFmpegPath(const fs::path &path)
Set the path to the FFmpeg executable.
void SetFrameRate(unsigned int fps)
Set the recording frame rate.
int GetFrameRate() const
Get the recording frame rate.
static std::string GetFileExtension(OutputFormat format)
Get the file extension corresponding to the specified video output format.
VideoRecorder & operator=(const VideoRecorder &)=delete
void RecordFrame() const
Record the current frame of the render window.
std::string GetRenderWindowName() const
Get the name of the render window being recorded.
VideoRecorder(const VideoRecorder &)=delete
void StartRecording()
Begin a recording session.
fs::path GetOutputPath() const
Get the path to the output video file.
OutputFormat GetOutputFormat() const
Get the output format (codec/container).
void SetRenderWindowName(const std::string &renderWindowName)
Set the name of the render window to record.
void SetOutputFormat(OutputFormat format)
Set the output format (codec/container).
fs::path GetFFmpegPath() const
Get the path to the FFmpeg executable.
void SetOutputPath(const fs::path &path)
Set the path for the output video file.
Portability header that provides a unified namespace alias for the C++ filesystem library.
Find image slices visible on a given plane.