将视频转换为色条
项目描述
movie_colorbar
一个简单的脚本,可以将视频转换为色条。
安装
先决条件
此代码与所有当前支持的Python版本兼容,并要求您在路径中安装ffmpgeg。您可以在虚拟环境中使用以下命令安装它:
python -m pip install movie_colorbar
用法
在已激活的环境中安装此软件包后,可以通过 python -m movie_colorbar
或通过新创建的 colorbar
命令来调用它。
详细用法如下
Usage: python -m movie_colorbar [OPTIONS] [SOURCE_PATH]
Turn a video into a colorbar.
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────╮
│ source_path [SOURCE_PATH] Location, relative or absolute, of the source video file │
│ to get the images from. │
│ [default: .] │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────╮
│ --title TEXT Name that will be given to the output directory. │
│ [default: output] │
│ --method TEXT Method used to calculate the average color. Options │
│ are: 'rgb', 'hsv', 'hue', 'kmeans', 'common', 'lab', │
│ 'xyz', 'rgbsquared', 'resize' and 'quantized'. │
│ [default: rgbsquared] │
│ --fps INTEGER Number of frames to extract per second of video │
│ footage. │
│ [default: 10] │
│ --log-level TEXT The base console logging level. Can be 'debug', │
│ 'info', 'warning' and 'error'. │
│ [default: info] │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or │
│ customize the installation. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
一个示例命令如下
python -m movie_colorbar ~/Desktop/STARWARS_9_TRAILER.webm --title sw9_trailer --method rgbsquared --fps 25
脚本将调用 ffmpeg
从视频文件中提取每秒25帧(在这种情况下)的图像。然后,它将应用所选方法(此处为 rgbsquared
)以确定每帧的平均颜色。最后,它使用所有平均值创建色条,并将其保存在一个名为 bars/title
的新文件夹中,其中 title
是您提供的参数。最终输出的名称是提供的文件名和使用的方法的组合。将目录作为输入将处理该目录中找到的所有视频文件。
建议在处理如整部电影这样的长视频时降低fps。
待办事项
- 完成后删除
images
文件夹。 - 将其转换为软件包。
- 改进命令行体验。
- 提供一次性完成所有操作的选项。
输出示例
以下是在运行在最后一条《星球大战9》预告片上的脚本输出示例。所有方法的输出都可以在仓库的bars
文件夹中找到。
Kmeans:
Rgb:
Rgbsquared:
Lab:
由 fsoubelet 用♥制作
MIT © 2019 Felix Soubelet
MIT © 2019 Felix Soubelet
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源分发
movie_colorbar-0.2.2.tar.gz (93.1 kB 查看散列)
构建分发
movie_colorbar-0.2.2-py3-none-any.whl (10.3 kB 查看散列)
关闭
movie_colorbar-0.2.2.tar.gz的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | d43201fe2573fef61107f4b76b959586a27592c621063ff35073a01f71ece8a6 |
|
MD5 | 56cb96ebfbcf5416b9aaecfba48f887f |
|
BLAKE2b-256 | e4a647d7dda5268512e3a2a127a7bf1ead72bd29008ea868e1e4b7522d6e804f |
关闭
movie_colorbar-0.2.2-py3-none-any.whl的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 782b8f4372f4c53e755a0cb91d3af3609baf326753f8c4082ede6299cc291d7b |
|
MD5 | c7e3d2eaf679fef1a5b5173ad7b5f823 |
|
BLAKE2b-256 | 9933e54e6812cc82dddecde5460c54626352953f31113892dd7e6ab3507309aa |