1.5 KiB
1.5 KiB
API Documentation
This document provides API documentation for using video_probe as a library.
Installation
Add to your Cargo.toml:
[dependencies]
video_probe = { path = "../video_probe" }
Quick Start
use video_probe::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Probe video
let metadata = probe_video("video.mp4")?;
// Access metadata
println!("Duration: {} seconds", metadata.format.duration);
if let Some(ref video) = metadata.video_stream {
println!("Resolution: {}x{}", video.width, video.height);
}
// Save to file
let output_file = save_metadata("video.mp4", &metadata)?;
println!("Saved to: {}", output_file);
Ok(())
}
Core Functions
probe_video
pub fn probe_video(video_path: &str) -> Result<VideoMetadata>
Probes a video file and returns metadata.
probe_video_to_file
pub fn probe_video_to_file(video_path: &str) -> Result<String>
Probes a video and saves metadata to JSON file.
save_metadata
pub fn save_metadata(video_path: &str, metadata: &VideoMetadata) -> Result<String>
Saves metadata to a JSON file.
print_summary
pub fn print_summary(metadata: &VideoMetadata)
Prints formatted summary to console.
Data Structures
VideoMetadata
video_path: Stringprobed_at: DateTimeformat: FormatInfovideo_stream: Optionaudio_streams: Vecsubtitle_streams: Vec