simple_video/
simple_video.rs1use cascii::{AsciiConverter, ConversionOptions, VideoOptions};
5use std::path::Path;
6
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let converter = AsciiConverter::new();
10
11 let video_opts = VideoOptions {
13 fps: 10,
14 start: Some("0".to_string()),
15 end: Some("2".to_string()), columns: 200,
17 extract_audio: false,
18 preprocess_filter: None,
19 };
20
21 let conv_opts = ConversionOptions::default()
23 .with_font_ratio(0.5)
24 .with_luminance(20);
25
26 let input = Path::new("tests/video/input/test.mkv");
28 let output_dir = Path::new("example_video_output");
29
30 if input.exists() {
31 println!("Converting video to ASCII frames...");
32 println!("Input: {}", input.display());
33 println!("Output: {}", output_dir.display());
34 println!("Settings: {}fps, {}s duration", video_opts.fps, 2);
35
36 converter.convert_video(
37 input,
38 output_dir,
39 &video_opts,
40 &conv_opts,
41 false, )?;
43
44 println!("✓ Video conversion complete!");
45 println!("ASCII frames saved to {}", output_dir.display());
46 } else {
47 println!("Note: {} not found.", input.display());
48 println!("To use this example, provide a video file at that path.");
49 }
50
51 Ok(())
52}