ClikaRT::io::VideoWriter
class
Header: ClikaRT/io/video.h
Encode a stream of channels-last RGB [H, W, 3] UInt8 frames to a video file, with an optional audio track. Move-only. Every fallible method raises ClikaRT::Error on failure.
Static member functions
open(string_view, string_view, double, int, …)
static VideoWriter open(
std::string_view path,
std::string_view codec,
double fps,
int width,
int height
)
Open a writer to path producing codec at fps and width×height. An empty codec picks the first encoder the discovered set offers along a fixed preference list (h264, hevc, vp9, mpeg4) and logs the pick; a named codec is kept as given and fails when its encoder is absent, naming the encoders found. path / codec are copied.
Declared in ClikaRT/io/video.h, line 169
open(string_view, string_view, double, int, …)
static VideoWriter open(
std::string_view path,
std::string_view codec,
double fps,
int width,
int height,
const AudioTrack& audio
)
Open a writer to path producing codec at fps and width×height. An empty codec picks the first encoder the discovered set offers along a fixed preference list (h264, hevc, vp9, mpeg4) and logs the pick; a named codec is kept as given and fails when its encoder is absent, naming the encoders found. path / codec are copied.
Declared in ClikaRT/io/video.h, line 181
Member functions
VideoWriter()
VideoWriter(VideoWriter&&) noexcept
Declared in ClikaRT/io/video.h, line 187
operator=()
VideoWriter& operator=(VideoWriter&&) noexcept
Move-assign: transfers the writer.
Declared in ClikaRT/io/video.h, line 189
~VideoWriter()
~VideoWriter()
Finalizes the container if still open, then releases the writer.
Declared in ClikaRT/io/video.h, line 191
write_frame()
void write_frame(const Tensor& frame)
Append one [H, W, 3] UInt8 frame (geometry must match the writer's). An undefined tensor is refused like any other frame the writer cannot take: a caller holding one after a lookup that missed gets an error, never a crash.
Declared in ClikaRT/io/video.h, line 198
write_audio()
void write_audio(const Tensor& samples)
Append interleaved audio samples to the track declared at open: [frames, channels] (or [frames] for a mono track), a float dtype in [-1, 1] or Int16 PCM codes, on any device. The first call pins the PCM dtype the track is written at. Refused on a writer opened without a track, on a channel count other than the declared one, and on a second dtype mid-track; close refuses a declared track that received none.
Declared in ClikaRT/io/video.h, line 207
close()
void close()
Finalize the file (also runs implicitly on destruction if not called).
Declared in ClikaRT/io/video.h, line 211