All examples
Video and vision

Record and replay a video

Write a new lossless Matroska recording from synthetic frames and read every delivered frame back.

video_recording.aner
// Requires the optional FFmpeg backend and a fresh writable working directory.
// Creates capture.mkv exclusively; never overwrites an existing recording.
import aner.video

let source = video.synthetic(width: 160, height: 120, frames: 12)
let frame = video.frame_slot()
let recording = video.record("capture.mkv", width: 160, height: 120, fps: 30.0)
while source.read_into(frame) == "ready" {
    recording.write(frame)
}
recording.close()
source.close()
print(recording.frames_written())

let replay = video.file("capture.mkv")
while replay.read_into(frame) == "ready" {
    print(frame.sequence())
}
print(replay.delivered())
replay.close()

Make it your experiment.

Use Aner 0.1.0 or newer. Save this program as examples/video_recording.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/video_recording.aner
aner run examples/video_recording.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires Aner 0.1.0 or newer. Synthetic capture and CPU vision examples need no external source; cameras, remote media and encoded recording require optional FFmpeg support and explicit inputs. Checking opens no camera, network connection or recording.

Credential setup
aner check examples/video_recording.aner
aner run examples/video_recording.aner

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner