项目初始化完成 - 创建 cargos/tvai 项目结构 - 配置 Cargo.toml 依赖和工作空间 - 实现基础错误类型 TvaiError FFmpeg 管理模块 - 实现 FfmpegManager 结构体 - FFmpeg 路径检测和验证 (系统 vs Topaz) - 基础命令执行框架 - 支持 Windows/Linux/macOS 平台 核心处理引擎框架 - TvaiProcessor 主结构体 - TvaiConfig 配置管理和 Builder 模式 - 临时文件管理和自动清理 - GPU 检测和配置 模型和参数定义 - 16种超分辨率模型枚举 (Iris3, Nyx3, Thf4 等) - 4种插值模型枚举 (Apo8, Chr2 等) - 质量预设和编码设置 - 完整的参数结构体和验证 模块结构完整 - video/ 视频处理模块框架 - image/ 图片处理模块框架 - config/ 配置管理模块 - utils/ 工具函数模块 系统检测功能 - Topaz Video AI 安装检测 - GPU 支持检测 - FFmpeg 可用性检测 文档和示例 - 完整的 README 文档 - 基础使用示例 - API 文档注释 测试结果 - 编译通过 (cargo check) - 示例运行成功 - 检测到 Topaz Video AI 安装 - 所有模块结构就绪 下一步: 开始阶段二 - 核心处理引擎实现 |
||
|---|---|---|
| .. | ||
| 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.