视频格式转换功能 - 实现 images_to_video() 图像序列转视频 - 实现 video_to_images() 视频转图像序列 - 支持多种图像格式 (PNG, JPG, TIFF, BMP) - 智能帧序列处理和命名 - 质量预设和编码参数优化 视频超分辨率处理 - 实现 upscale_video() 完整超分辨率功能 - 支持所有 16 种 Topaz AI 模型 - 参数验证和模型约束检查 - GPU 加速和编码优化 - 自动 Topaz FFmpeg 滤镜构建 帧插值功能 - 实现 interpolate_video() 帧插值处理 - 支持所有 4 种插值模型 - 智能 FPS 计算和目标帧率设置 - 高质量慢动作效果生成 - 参数验证和范围检查 组合处理流水线 - 实现 enhance_video() 组合增强功能 - 支持超分辨率 + 插值的完整流水线 - 智能中间文件管理 - 灵活的处理组合选项 - 自动临时文件清理 便捷处理函数 - quick_upscale_video() 一键视频放大 - auto_enhance_video() 智能自动增强 - 自动 Topaz 检测和配置 - 基于视频特征的参数选择 - 默认高质量设置 预设参数系统 - VideoUpscaleParams::for_old_video() 老视频修复 - VideoUpscaleParams::for_game_content() 游戏内容 - VideoUpscaleParams::for_animation() 动画内容 - VideoUpscaleParams::for_portrait() 人像视频 - InterpolationParams::for_slow_motion() 慢动作 - InterpolationParams::for_animation() 动画插值 完整示例和演示 - 创建 video_processing.rs 综合示例 - 展示所有视频处理场景 - 参数配置和模型选择演示 - 格式转换和组合处理演示 - 便捷函数使用演示 技术特性 - 完整的 Topaz Video AI 集成 - 智能参数验证和错误处理 - 进度回调支持 (基础实现) - 异步处理和资源管理 - 跨平台兼容性 代码质量 - 所有测试通过 (6/6 单元测试 + 1 文档测试) - 完整的错误处理和验证 - 内存安全的资源管理 - 清晰的 API 设计 功能覆盖 - 视频超分辨率 (16 种模型) - 帧插值 (4 种模型) - 格式转换 (图像序列 视频) - 组合处理流水线 - 便捷处理函数 - 智能参数预设 下一步: 开始阶段四 - 图片处理功能实现 |
||
|---|---|---|
| .. | ||
| examples | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
README.md
TVAI - Topaz Video AI Integration Library
A Rust library for integrating with Topaz Video AI to perform video and image enhancement including super-resolution upscaling and frame interpolation.
Features
- 🎬 Video Super-Resolution: Upscale videos using AI models
- 🎞️ Frame Interpolation: Create smooth slow motion effects
- 🖼️ Image Upscaling: Enhance image resolution and quality
- ⚡ GPU Acceleration: CUDA and hardware encoding support
- 🔧 Multiple AI Models: 16 upscaling and 4 interpolation models
- 📦 Batch Processing: Process multiple files efficiently
- 🎛️ Flexible Configuration: Fine-tune processing parameters
Requirements
- Topaz Video AI installed
- Rust 1.70+
- FFmpeg (included with Topaz Video AI)
- Optional: CUDA-compatible GPU for acceleration
Installation
Add this to your Cargo.toml:
[dependencies]
tvai = "0.1.0"
Quick Start
Video Upscaling
use tvai::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Quick 2x upscaling
quick_upscale_video(
std::path::Path::new("input.mp4"),
std::path::Path::new("output.mp4"),
2.0,
).await?;
Ok(())
}
Image Upscaling
use tvai::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Quick 4x image upscaling
quick_upscale_image(
std::path::Path::new("photo.jpg"),
std::path::Path::new("photo_4x.png"),
4.0,
).await?;
Ok(())
}
Advanced Usage
use tvai::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Detect Topaz installation
let topaz_path = detect_topaz_installation()
.ok_or("Topaz Video AI not found")?;
// Create configuration
let config = TvaiConfig::builder()
.topaz_path(topaz_path)
.use_gpu(true)
.build()?;
// Create processor
let processor = TvaiProcessor::new(config)?;
// Custom upscaling parameters
let params = VideoUpscaleParams {
scale_factor: 2.0,
model: UpscaleModel::Iris3,
compression: 0.0,
blend: 0.1,
quality_preset: QualityPreset::HighQuality,
};
// Process video
let result = processor.upscale_video(
std::path::Path::new("input.mp4"),
std::path::Path::new("output.mp4"),
params,
).await?;
println!("Processing completed in {:?}", result.processing_time);
Ok(())
}
AI Models
Upscaling Models
- Iris v3 - Best general purpose model
- Nyx v3 - Optimized for portraits
- Theia Fidelity v4 - Old content restoration
- Gaia HQ v5 - Game/CG content
- Proteus v4 - Problem footage repair
- And more...
Interpolation Models
- Apollo v8 - High quality interpolation
- Chronos v2 - Animation content
- Apollo Fast v1 - Fast processing
- Chronos Fast v3 - Fast animation
Presets
The library includes optimized presets for common use cases:
// Video presets
let old_video_params = VideoUpscaleParams::for_old_video();
let game_params = VideoUpscaleParams::for_game_content();
let animation_params = VideoUpscaleParams::for_animation();
let portrait_params = VideoUpscaleParams::for_portrait();
// Image presets
let photo_params = ImageUpscaleParams::for_photo();
let artwork_params = ImageUpscaleParams::for_artwork();
let screenshot_params = ImageUpscaleParams::for_screenshot();
System Detection
// Detect Topaz installation
let topaz_path = detect_topaz_installation();
// Check GPU support
let gpu_info = detect_gpu_support();
// Check FFmpeg availability
let ffmpeg_info = detect_ffmpeg();
Error Handling
The library uses the anyhow crate for error handling:
use tvai::*;
match quick_upscale_video(input, output, 2.0).await {
Ok(result) => println!("Success: {:?}", result),
Err(TvaiError::TopazNotFound(path)) => {
eprintln!("Topaz not found at: {}", path);
},
Err(TvaiError::FfmpegError(msg)) => {
eprintln!("FFmpeg error: {}", msg);
},
Err(e) => eprintln!("Other error: {}", e),
}
Development Status
This library is currently in development. The following features are planned:
- Basic project structure
- FFmpeg management
- Core processor framework
- Video upscaling implementation
- Frame interpolation implementation
- Image upscaling implementation
- Batch processing
- Progress callbacks
- Comprehensive testing
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.