Skip to main content

批量压缩视频素材的 CLI 工具

Project description

🎬 Video Toolkit Litouge

一个用于批量压缩视频素材的 Python 工具,支持 .mov 转码、.mp4 压缩、智能分辨率控制、输出目录指定、GPU 加速、快速压缩模式、原始视频处理策略等功能。适用于素材库清理、自动化预处理、视频体积优化等场景。


🚀 安装

确保你已安装 ffmpeg 并将其加入系统 PATH。

然后在项目根目录执行:

pip install .

或开发模式安装(推荐调试时使用):

pip install -e .

🧪 使用示例

video-toolkit-litouge -d ./videos -s 100 -c 26 -r 1920x1080 -o ./output -f -g -w --handle-original rename

⚙️ 参数说明

参数 简写 说明
--directory -d 要处理的根目录(必填)
--size -s 文件大小阈值(单位 MB,默认 100)
--crf -c 压缩质量(默认 26,范围 18–35)
--resolution -r 目标分辨率(如 1920x1080,仅对高于此分辨率的视频生效)
--output-dir -o 压缩文件输出目录(默认保存在源目录)
--verbose -v 显示 ffmpeg 输出信息(调试用)
--fast -f 使用快速压缩模式(preset=fast)
--gpu -g 使用 GPU 编码(h264_nvenc)
--dry-run -n 仅打印将处理的文件,不执行压缩
--overwrite -w 强制覆盖已存在的压缩文件
--handle-original 压缩后如何处理原始文件:move_local(默认)、renamenonemove_to
--original-target 原始文件移动目标目录(仅在 move_to 模式下使用)

⚠️ --prefix 参数已废弃,压缩后文件将保留原始文件名。


📦 依赖

  • ffmpeg(必须安装并加入系统 PATH)
  • tqdm

安装依赖:

pip install tqdm

🧠 示例用途

  • 批量压缩 .mov 素材为 .mp4
  • 自动统一分辨率为 1920x1080
  • 清理素材库中超过 100MB 的视频
  • 使用 GPU 加速压缩过程
  • 快速预览将要处理的文件(dry-run)
  • 压缩后将原始视频移动到 compressed/ 子目录或指定目录

📁 项目结构建议

video_toolkit/
├── video_toolkit/
│   ├── __init__.py
│   ├── cli.py
│   ├── compressor.py
│   ├── utils.py
├── pyproject.toml
├── README.md
├── requirements.txt

🧼 后续规划

  • ✅ 支持多线程并发处理
  • ✅ 支持 YAML 配置文件
  • ✅ 支持更多格式(如 .avi, .mkv
  • ✅ 支持压缩统计与日志输出

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

video_toolkit_litouge-0.1.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

video_toolkit_litouge-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file video_toolkit_litouge-0.1.1.tar.gz.

File metadata

  • Download URL: video_toolkit_litouge-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for video_toolkit_litouge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 11f9a0c1cb60959aa5c52811ae294b07f5e668e87e21770fd4f9059f5ac7f394
MD5 a9aa549fdd98435c79d46e7256c4a2b6
BLAKE2b-256 98a60f47a5bc1a853829b0e7334306be4858f752370998fea242f934074c31f2

See more details on using hashes here.

File details

Details for the file video_toolkit_litouge-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for video_toolkit_litouge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18a8b518029317560f783a85ae35450533f00955454c1012ff7c97a4c4168bb5
MD5 d97c4040a0ea6aebcc682fa348e53443
BLAKE2b-256 d3266ad06c4f750be63121303ad7c92960aaeadc96015a6f3b43cee261d2b1ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page