FFmpeg CLI
Quick Reference
| Task | Command |
|---|
| Cut video | INLINECODE0 |
| Merge clips |
{baseDir}/scripts/merge.sh -o <output> <file1> <file2> ... |
| Extract audio |
{baseDir}/scripts/extract-audio.sh -i <video> -o <output.mp3> |
| Generate thumbnail |
{baseDir}/scripts/thumb.sh -i <video> -t <timestamp> -o <out.jpg> |
| Create GIF |
{baseDir}/scripts/gif.sh -i <video> -s <start> -e <end> -o <out.gif> |
| Convert format |
{baseDir}/scripts/convert.sh -i <input> -o <output.mp4> |
| Change speed |
{baseDir}/scripts/speed.sh -i <input> -r <0.5-2.0> -o <output> |
| Add watermark |
{baseDir}/scripts/watermark.sh -i <video> -w <image> -o <output> |
Scripts
cut.sh - Cut video segment
CODEBLOCK0
merge.sh - Concatenate videos
CODEBLOCK1
extract-audio.sh - Pull audio track
CODEBLOCK2
thumb.sh - Extract frame as image
CODEBLOCK3
gif.sh - Convert clip to GIF
CODEBLOCK4
convert.sh - Transcode to new format
CODEBLOCK5
speed.sh - Adjust playback speed
CODEBLOCK6
watermark.sh - Overlay image watermark
CODEBLOCK7
Notes
- - All scripts support common video formats (mp4, avi, mov, mkv, webm, etc.)
- Output quality is optimized for balanced file size and clarity
- Use
-h or no args to see script usage
FFmpeg CLI
快速参考
| 任务 | 命令 |
|---|
| 裁剪视频 | {baseDir}/scripts/cut.sh -i <输入> -s <开始> -e <结束> -o <输出> |
| 合并片段 |
{baseDir}/scripts/merge.sh -o <输出> <文件1> <文件2> ... |
| 提取音频 | {baseDir}/scripts/extract-audio.sh -i <视频> -o <输出.mp3> |
| 生成缩略图 | {baseDir}/scripts/thumb.sh -i <视频> -t <时间戳> -o <输出.jpg> |
| 创建GIF | {baseDir}/scripts/gif.sh -i <视频> -s <开始> -e <结束> -o <输出.gif> |
| 转换格式 | {baseDir}/scripts/convert.sh -i <输入> -o <输出.mp4> |
| 调整速度 | {baseDir}/scripts/speed.sh -i <输入> -r <0.5-2.0> -o <输出> |
| 添加水印 | {baseDir}/scripts/watermark.sh -i <视频> -w <图片> -o <输出> |
脚本
cut.sh - 裁剪视频片段
bash
{baseDir}/scripts/cut.sh -i video.mp4 -s 00:01:30 -e 00:02:45 -o clip.mp4
merge.sh - 合并视频
bash
{baseDir}/scripts/merge.sh -o merged.mp4 part1.mp4 part2.mp4 part3.mp4
extract-audio.sh - 提取音频轨道
bash
{baseDir}/scripts/extract-audio.sh -i video.mp4 -o audio.mp3
thumb.sh - 提取帧为图片
bash
{baseDir}/scripts/thumb.sh -i video.mp4 -t 00:00:15 -o frame.jpg
gif.sh - 将片段转换为GIF
bash
{baseDir}/scripts/gif.sh -i video.mp4 -s 00:00:10 -e 00:00:15 -o clip.gif
convert.sh - 转码为新格式
bash
{baseDir}/scripts/convert.sh -i input.avi -o output.mp4
speed.sh - 调整播放速度
bash
{baseDir}/scripts/speed.sh -i video.mp4 -r 2.0 -o fast.mp4 # 2倍速
{baseDir}/scripts/speed.sh -i video.mp4 -r 0.5 -o slow.mp4 # 0.5倍速
watermark.sh - 叠加图片水印
bash
{baseDir}/scripts/watermark.sh -i video.mp4 -w logo.png -o output.mp4
说明
- - 所有脚本均支持常见视频格式(mp4、avi、mov、mkv、webm等)
- 输出质量经过优化,兼顾文件大小与清晰度
- 使用 -h 或不带参数可查看脚本用法