Files
akmon/video_splitter/README.md
2026-01-20 08:04:15 +08:00

58 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 智能新闻拆条系统 (Smart News Splitter)
本项目演示了如何利用 **Qwen3-VL** 多模态大模型实现新闻节目的自动拆条、编目和入库。
## 项目结构
- `main.py`: 主程序入口协调预处理、AI分析和视频切割流程。
- `ai_agent.py`: 模拟 Qwen3-VL 的交互代理,负责视频内容理解和分段。
- `processor.py`: 封装 FFmpeg 操作,处理视频切割和音频提取。
- `requirements.txt`: 项目依赖。
## 核心流程
1. **预处理**: 提取视频音频,进行 ASR 转写(本项目使用模拟文本)。
2. **AI 分析**: 将视频帧和 ASR 文本发送给 Qwen3-VL模型返回结构化的新闻片段信息JSON
3. **物理切割**: 根据模型返回的时间戳,调用 FFmpeg 进行无损切割。
4. **自动编目**: 生成标题、摘要、标签和封面图,输出 `catalog_report.json`
## 快速开始
### 1. 安装依赖
确保系统已安装 [FFmpeg](https://ffmpeg.org/download.html) 并将其加入环境变量。
```bash
pip install -r requirements.txt
```
### 2. 运行拆条
准备一个新闻视频文件(例如 `news.mp4`),然后运行:
```bash
python main.py -i news.mp4 -o output_folder
```
> **注意**: 由于没有真实的 Qwen3-VL API Key`ai_agent.py` 目前返回的是模拟数据。在实际生产环境中,请替换 `analyze_video` 方法中的逻辑,接入 DashScope API。
## 实际接入指南
要接入真实的 Qwen3-VL请修改 `ai_agent.py`:
1. 安装 DashScope SDK: `pip install dashscope`
2. 配置 API Key: `dashscope.api_key = "YOUR_API_KEY"`
3. 构造多模态消息:
```python
messages = [
{
"role": "user",
"content": [
{"video": video_path},
{"text": "请分析这段视频,拆分出每条新闻..."}
]
}
]
```
4. 调用 `dashscope.MultiModalConversation.call()` 获取结果。