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.2.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.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: video_toolkit_litouge-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 cadca7dd2fabfd636224e0f56ec79015935075f4787e5e37f6b5d8fef142d9a8
MD5 ff3a5a5588301d9cd88e643a371aa45e
BLAKE2b-256 c2f3b587414b0eac4fad767debb5649115b8a5f84979581c3015b9d7ba786a11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for video_toolkit_litouge-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42cfd6ab27dcff2f82d7fc1ac959a8366bd0c45f096d370195ad1340b7ff7e50
MD5 91c2e51da227b83e0d2a8f1a7de08d45
BLAKE2b-256 43eaf46691629ce3a193fadbd804a5b175319ae03069e43e38f13571afeff7b5

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