Save Video to File
Description
Saves a video array to a file in various formats.
Usage
save_video(video, file, fps = 24, format = NULL, backend = "auto",
quality = 85, verbose = TRUE)
Arguments
video: Array of video frames with shape [T, H, W, C] where C is 3 (RGB). Values should be in [0, 1] range.file: Character. Output file path. Extension determines format.fps: Numeric. Frames per second (default 24).format: Character. Output format: “mp4”, “gif”, “webm”, or “frames”. If NULL, inferred from file extension.backend: Character. Backend to use: “ffmpeg”, “av”, or “auto”.quality: Integer. Quality level 1-100 (for lossy formats).verbose: Logical. Print progress messages.
Value
Invisibly returns the output file path.
Examples
# Save as MP4
save_video(video_array, "output.mp4", fps = 24)
# Save as GIF
save_video(video_array, "output.gif", fps = 10)
# Save as individual frames
save_video(video_array, "frames/", format = "frames")