用于媒体编辑的命令行工具
medipack的Python项目详细描述
Medipack
medipack是Media + Package
,一个用于trim
,crop
,resize
媒体文件的命令行工具。
它还可以用于从媒体文件中extract
输出audio
或video
。
安装
使用PIP安装(推荐)
sudo python3 -m pip install medipack
您可以使用--user
选项在本地为用户安装~/.local/bin
python3 -m pip install medipack --user
别忘了~/.local/bin
应该在你的PATH
中。在.bashrc
中添加export PATH=$PATH:"~/.local/bin"
行
从源代码生成
- 克隆存储库并签出到稳定提交
- git clone https://github.com/srbcheema1/medipack
- cd medipack
- git checkout <latest_version say: v0.0.x>
- `python3 setup.py install --user`
- 安装要求
python3 -m pip install --user -r requirements.txt
- 安装Medipack
python3 setup.py install --user
验证安装
- 检查工作情况
medipack -h
- 如果显示“帮助”消息,则表示您已准备就绪。
故障排除
如果medipack -h
不工作,请确保二进制路径在路径中。
在~/.bashrc
或~/.zshrc
中添加export PATH=$PATH:"~/.local/bin"
行
bash用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.bashrc
source ~/.bashrc
- zsh用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.zshrc
source ~/.zshrc
使用量
srb@srb-pc:$ medipack --help
usage: medipack.py [-h] [-v] {trim,crop,resize,extract} ...
positional arguments:
{trim,crop,resize,extract}
optional arguments:
-h, --help show this help message and exit
-v, --version Display version number
suboptions are:
trim trim a video/audio file from given starting point to given ending point.
crop crop frame window of video.
resize resize the file by reducing video quality. to make small size video files.
extract extract audio-only or video-only file from media file
For more help regarding suboptions run:
medipack trim -h
medipack crop -h
medipack resize -h
medipack extract -h
支持的格式
- MP4
- MP3
支持的操作
- 修剪
- 作物
- 调整大小
- 提取
示例
微调
srb@srb-pc:$ medipack trim -h
usage: medipack trim [-h] [-s START] [-e END | -t TIME] [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-s START, --start START
start time for cuting in format hh:mm:ss or mm:ss
-e END, --end END end time for cuting in format hh:mm:ss or mm:ss
-t TIME, --time TIME clip duration in format hh:mm:ss or mm:ss
-o OUTPUT, --output OUTPUT
- 从01:04到14:08剪辑视频
medipack trim input.mp4 -s 01:04 -e 14:08 -o output.mp4
medipack trim input.mp4 -s 01:04 -t 13:04 -o output.mp4
medipack trim input.mp4 -s 01:04 -e 14:08
medipack trim input.mp4 -s 01:04 -t 13:04
medipack trim input.mp4
medipack trim
- 将音频从01:04修剪到14:08
medipack trim input.mp3 -s 01:04 -e 14:08 -o output.mp3
裁剪
srb@srb-pc:$ medipack crop -h
usage: medipack crop [-h] [-t TOP] [-b BOTTOM] [-l LEFT] [-r RIGHT]
[-o OUTPUT]
[inp]
positional arguments:
inp input video file ex: input.mp4 (default: None)
optional arguments:
-h, --help show this help message and exit
-t TOP, --top TOP percentage of screen to be chopped from top (default: 0)
-b BOTTOM, --bottom BOTTOM
percentage of screen to be chopped from bottom (default: 0)
-l LEFT, --left LEFT percentage of screen to be chopped from left (default: 0)
-r RIGHT, --right RIGHT
percentage of screen to be chopped from right (default: 0)
-o OUTPUT, --output OUTPUT
output file name, ex: output.mp4 (default: None)
- 裁剪视频窗口的右下角
medipack crop input.mp4 -t 50 -l 50 -o output.mp4
medipack crop input.mp4 -t 50 -l 50
- 把前10%的面积挖掉
medipack crop input.mp4 -t 10 -o output.mp4
- 把20%的面积都挖出来
medipack crop input.mp4 -r 20 -o output.mp4
- 把前10%的面积和右边20%的面积挖掉
medipack crop input.mp4 -t 10 -r 20 -o output.mp4
调整大小
srb@srb-pc:$ medipack resize -h
usage: medipack resize [-h] [-q QUALITY] [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-q QUALITY, --quality QUALITY
output video quality (on scale of 100) (default: 50)
-o OUTPUT, --output OUTPUT
output file name, ex: output.mp4
- 调整视频大小以减小其大小
medipack resize input.mp4 -q 40 -o output.mp4
medipack resize input.mp4 -q 40
提取
srb@srb-pc:$ medipack extract -h
usage: medipack extract [-h] (-v | -a) [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-v, --video
-a, --audio
-o OUTPUT, --output OUTPUT
output file name
- 从媒体文件中提取音频
medipack extract --audio input.mp4 -o output.mp3
medipack extract --audio input.mp4
- 从媒体文件中提取视频
medipack extract input.mp4 --video -o output.mp4
medipack extract input.mp4 --video
注
- 对于音频输入文件,仅支持修剪操作。
- 如果不提供输出文件,则输出文件将命名为base.extension file的“输出”[此输出文件中的
extract
选项除外,默认情况下将获取name.mp3] - 您可以跳过选项,medikit足够聪明,可以根据需要检测或询问所需选项
- 如果有任何错误/问题,请向srbcheema2@gmail.com报告或者,更好的是,提交一个公关来修复它
联系人/社交媒体
- git clone https://github.com/srbcheema1/medipack
- cd medipack
- git checkout <latest_version say: v0.0.x>
- `python3 setup.py install --user`
python3 -m pip install --user -r requirements.txt
python3 setup.py install --user
medipack -h
如果medipack -h
不工作,请确保二进制路径在路径中。
在~/.bashrc
或~/.zshrc
中添加export PATH=$PATH:"~/.local/bin"
行
bash用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.bashrc
source ~/.bashrc
echo export PATH="$PATH":"~/.local/bin" >> ~/.zshrc
source ~/.zshrc
srb@srb-pc:$ medipack --help
usage: medipack.py [-h] [-v] {trim,crop,resize,extract} ...
positional arguments:
{trim,crop,resize,extract}
optional arguments:
-h, --help show this help message and exit
-v, --version Display version number
suboptions are:
trim trim a video/audio file from given starting point to given ending point.
crop crop frame window of video.
resize resize the file by reducing video quality. to make small size video files.
extract extract audio-only or video-only file from media file
For more help regarding suboptions run:
medipack trim -h
medipack crop -h
medipack resize -h
medipack extract -h
srb@srb-pc:$ medipack trim -h
usage: medipack trim [-h] [-s START] [-e END | -t TIME] [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-s START, --start START
start time for cuting in format hh:mm:ss or mm:ss
-e END, --end END end time for cuting in format hh:mm:ss or mm:ss
-t TIME, --time TIME clip duration in format hh:mm:ss or mm:ss
-o OUTPUT, --output OUTPUT
medipack trim input.mp4 -s 01:04 -e 14:08 -o output.mp4
medipack trim input.mp4 -s 01:04 -t 13:04 -o output.mp4
medipack trim input.mp4 -s 01:04 -e 14:08
medipack trim input.mp4 -s 01:04 -t 13:04
medipack trim input.mp4
medipack trim
medipack trim input.mp3 -s 01:04 -e 14:08 -o output.mp3
srb@srb-pc:$ medipack crop -h
usage: medipack crop [-h] [-t TOP] [-b BOTTOM] [-l LEFT] [-r RIGHT]
[-o OUTPUT]
[inp]
positional arguments:
inp input video file ex: input.mp4 (default: None)
optional arguments:
-h, --help show this help message and exit
-t TOP, --top TOP percentage of screen to be chopped from top (default: 0)
-b BOTTOM, --bottom BOTTOM
percentage of screen to be chopped from bottom (default: 0)
-l LEFT, --left LEFT percentage of screen to be chopped from left (default: 0)
-r RIGHT, --right RIGHT
percentage of screen to be chopped from right (default: 0)
-o OUTPUT, --output OUTPUT
output file name, ex: output.mp4 (default: None)
medipack crop input.mp4 -t 50 -l 50 -o output.mp4
medipack crop input.mp4 -t 50 -l 50
medipack crop input.mp4 -t 10 -o output.mp4
medipack crop input.mp4 -r 20 -o output.mp4
medipack crop input.mp4 -t 10 -r 20 -o output.mp4
srb@srb-pc:$ medipack resize -h
usage: medipack resize [-h] [-q QUALITY] [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-q QUALITY, --quality QUALITY
output video quality (on scale of 100) (default: 50)
-o OUTPUT, --output OUTPUT
output file name, ex: output.mp4
medipack resize input.mp4 -q 40 -o output.mp4
medipack resize input.mp4 -q 40
srb@srb-pc:$ medipack extract -h
usage: medipack extract [-h] (-v | -a) [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-v, --video
-a, --audio
-o OUTPUT, --output OUTPUT
output file name
- 从媒体文件中提取音频
medipack extract --audio input.mp4 -o output.mp3
medipack extract --audio input.mp4
- 从媒体文件中提取视频
medipack extract input.mp4 --video -o output.mp4
medipack extract input.mp4 --video
注
- 对于音频输入文件,仅支持修剪操作。
- 如果不提供输出文件,则输出文件将命名为base.extension file的“输出”[此输出文件中的
extract
选项除外,默认情况下将获取name.mp3] - 您可以跳过选项,medikit足够聪明,可以根据需要检测或询问所需选项
- 如果有任何错误/问题,请向srbcheema2@gmail.com报告或者,更好的是,提交一个公关来修复它
联系人/社交媒体
通过
开发开发人员/作者:Srb Cheema