视频混剪V2
Go to file
root 1ff49a3c26 refactor: 统一使用相对导入,规范 Python 包结构
🏗️ **Python 包结构规范化**:

1. **导入方式统一**:
   - 移除所有 sys.path.append() hack 方式
   - 统一使用相对导入 (from ..config import settings)
   - 符合 Python 包管理最佳实践

2. **包结构简化**:
   - 简化 python_core/__init__.py,移除复杂依赖
   - 避免包初始化时的循环导入问题
   - 清理不必要的 try-except 导入逻辑

3. **模块运行方式**:
   - 支持标准的模块运行: python -m python_core.ai_video.video_generator
   - Rust 代码使用 -m 参数调用 Python 模块
   - 相对导入在模块运行时正常工作

4. **涉及文件修改**:
   - python_core/__init__.py: 简化包初始化
   - python_core/ai_video/video_generator.py: 相对导入
   - python_core/ai_video/cloud_storage.py: 移除 fallback 逻辑
   - python_core/ai_video/api_client.py: 统一相对导入
   - python_core/video_processing/core.py: 相对导入
   - python_core/audio_processing/core.py: 相对导入
   - python_core/utils/logger.py: 相对导入
   - python_core/services/*.py: 统一相对导入
   - src-tauri/src/commands/ai_video.rs: 使用模块运行方式

5. **代码质量提升**:
   - 移除重复的 sys.path 操作
   - 清理冗余的 try-except 导入
   - 统一的错误处理方式
   - 更清晰的模块依赖关系

 **改进效果**:
- 符合 Python 最佳实践 ✓
- 代码结构更清晰 ✓
- 易于维护和测试 ✓
- 消除 hack 式路径操作 ✓
- 支持标准模块运行 ✓

现在整个 Python 包结构规范且易于维护!
2025-07-10 14:47:32 +08:00
python_core refactor: 统一使用相对导入,规范 Python 包结构 2025-07-10 14:47:32 +08:00
src fix: 修复 AIVideoGenerator 组件中的 Store Hooks 使用错误 2025-07-10 14:12:23 +08:00
src-tauri refactor: 统一使用相对导入,规范 Python 包结构 2025-07-10 14:47:32 +08:00
.gitignore first commit 2025-07-10 09:41:40 +08:00
README.md first commit 2025-07-10 09:41:40 +08:00
gemini.md feat: 增强 AI 视频生成错误诊断和调试功能 2025-07-10 11:10:32 +08:00
index.html first commit 2025-07-10 09:41:40 +08:00
install_ai_video_deps.py fix: 修复 AI 视频生成参数和依赖问题 2025-07-10 11:25:55 +08:00
jm_video_ui.md feat: 集成 AI 视频生成功能到 MixVideo V2 2025-07-10 10:43:40 +08:00
package.json fix: 修复窗口控制功能 - 拖拽、最小化、最大化、关闭 2025-07-10 10:20:41 +08:00
pnpm-lock.yaml fix: 修复窗口控制功能 - 拖拽、最小化、最大化、关闭 2025-07-10 10:20:41 +08:00
postcss.config.js first commit 2025-07-10 09:41:40 +08:00
prompt.md first commit 2025-07-10 09:41:40 +08:00
tailwind.config.js first commit 2025-07-10 09:41:40 +08:00
test_image.jpg feat: 完全修复 AI 视频生成功能 - 端到端成功!🎉 2025-07-10 11:32:22 +08:00
test_path_fix.py fix: 修复 Windows 系统下 Python 脚本路径问题 2025-07-10 11:15:47 +08:00
tsconfig.json first commit 2025-07-10 09:41:40 +08:00
tsconfig.node.json first commit 2025-07-10 09:41:40 +08:00
vite.config.ts first commit 2025-07-10 09:41:40 +08:00

README.md

MixVideo V2 - 视频混剪软件

A modern video editing software built with Tauri (Rust + React) frontend and Python core processing engine.

Architecture

分层架构设计 (Layered Architecture)

  • 前端层 (Frontend Layer): Tauri + React - UI渲染和用户交互
  • 桥接层 (Bridge Layer): Tauri Commands - 前端与Python核心的通信
  • 核心层 (Core Layer): Python - 视频处理核心逻辑
  • 服务层 (Service Layer): Python - 后台服务和文件管理

Project Structure

mixvideo_v2/
├── src-tauri/              # Tauri backend (Rust)
│   ├── src/
│   │   ├── main.rs
│   │   ├── commands/       # Tauri commands for Python bridge
│   │   └── utils/
│   ├── Cargo.toml
│   └── tauri.conf.json
├── src/                    # React frontend
│   ├── components/         # UI components
│   ├── hooks/             # React hooks
│   ├── services/          # API services
│   ├── stores/            # State management
│   └── utils/
├── python_core/           # Python video processing engine
│   ├── video_processing/  # Core video processing modules
│   ├── audio_processing/  # Audio processing modules
│   ├── services/          # Background services
│   ├── utils/             # Utility functions
│   └── requirements.txt
├── assets/                # Static assets
├── docs/                  # Documentation
└── tests/                 # Test files

Core Libraries

Video Processing

  • MoviePy: 剪辑拼接、字幕添加、特效调整
  • FFmpeg-Python: 底层编码/解码、格式转换
  • OpenCV-Python: 帧级处理、人脸识别
  • PySceneDetect: 自动检测镜头切换点

Audio Processing

  • Librosa: 节拍跟踪、频谱分析
  • Pydub: 音频剪切、音量调整、混音
  • PyAudio: 麦克风输入流采集
  • Spleeter: 人声/伴奏分离

AI & Machine Learning

  • Video-Transformers: 视频内容理解
  • Magenta: AI音乐生成
  • TempoCNN: 基于CNN的BPM预测

Getting Started

Prerequisites

  • Node.js 18+
  • Rust 1.70+
  • Python 3.9+
  • FFmpeg

Installation

  1. Clone the repository
  2. Install frontend dependencies: npm install
  3. Install Python dependencies: pip install -r python_core/requirements.txt
  4. Run development server: npm run tauri dev

Features

  • 🎬 视频剪辑拼接
  • 🎵 音频处理与节拍同步
  • 🎨 特效与滤镜
  • 🤖 AI辅助剪辑
  • 📱 多平台适配
  • 分布式任务处理

License

MIT License