|
JNGL
Easy to use cross-platform 2D game library
|
Records video and audio output to a file. More...
#include <jngl/record/VideoRecorder.hpp>
Public Member Functions | |
| VideoRecorder (std::string_view filename) | |
| Creates a new video recorder that writes to the specified file (saved in your data/ directory). | |
| ~VideoRecorder () override | |
| Finalizes and closes the video file. | |
| VideoRecorder (const VideoRecorder &)=delete | |
| VideoRecorder & | operator= (const VideoRecorder &)=delete |
| VideoRecorder (VideoRecorder &&)=delete | |
| VideoRecorder & | operator= (VideoRecorder &&)=delete |
| void | fillAudioBuffer (std::unique_ptr< float[]> samples) |
| Assumes 44.1 kHz, stereo audio input and getting called exactly getStepsPerSecond() times per second. | |
| void | step () override |
| Advance the game logic. | |
| void | draw () const override |
| Draw the game state. | |
Public Member Functions inherited from Job | |
| virtual void | onFileDrop (const std::filesystem::path &) |
| Called when a file has been dropped onto the window. | |
| virtual void | onControllersChanged () |
| Whenever the return value of jngl::getConnectedControllers would change, this method gets called. | |
| Job ()=default | |
| Does nothing. | |
| Job (const Job &)=default | |
| Copy constructor. | |
| Job & | operator= (const Job &)=default |
| Copy assignment. | |
| Job (Job &&)=default | |
| Move constructor. | |
| Job & | operator= (Job &&)=default |
| Move assignment. | |
| virtual | ~Job () |
| Does nothing. | |
Records video and audio output to a file.
VideoRecorder is a background job that captures the rendered frames and audio samples to create a video file. It uses FFV1 codec for lossless video compression and FLAC for lossless audio compression, packaged in a Matroska container.
The recorder captures:
Example usage:
The VideoRecorder will automatically capture frames and audio as your application runs. Remove the job or let it go out of scope to finalize and close the video file.
Definition at line 48 of file VideoRecorder.hpp.
|
explicit |
Creates a new video recorder that writes to the specified file (saved in your data/ directory).
Initializes video and audio encoding with the following settings:
| filename | Path to the output video file (typically with .mkv extension) |
| std::runtime_error | if video encoding setup fails (e.g., codecs not found, file cannot be opened) |
|
override |
Finalizes and closes the video file.
Flushes any remaining frames and audio data, writes the container trailer, and releases all encoding resources.
|
overridevirtual |
Advance the game logic.
This function gets called 60 times per second or whatever has been set by setStepsPerSecond().
Implements Job.
|
overridevirtual |