用 FFmpeg 裁剪视频画面
使用 crop 滤镜裁掉视频两侧的黑边、台标或多余内容,时长不变,音频原样保留。
执行 ffmpeg -i input.mp4 -vf "crop=1280:720:100:60" -c:a copy output.mp4,即从距左边 100 像素、距顶部 60 像素处裁出 1280x720 画面。
01命令
命令
$ ffmpeg -i input.mp4 -vf "crop=1280:720:100:60" -c:a copy output.mp402作用说明
crop 滤镜的四个数字依次是宽、高以及裁剪窗口左上角的 x、y 坐标——它只裁剪像素,不会缩放画面。可以使用表达式自动计算,例如 crop=in_w-200:in_h 表示左右各裁掉 100 像素,crop=iw/2:ih/2 表示保留正中央四分之一的画面。音频采用流复制,音质不受影响;与截取片段(-t)不同,视频时长完全不变。
03风险
!注意: 裁剪后的宽和高都必须是偶数,否则很多编码器和播放器会拒绝该文件;必要时在表达式中使用 round() 取整。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- ffmpeg(1) — Linux manual page依据: Documents -vf filter chains and audio stream copying with -c:a copy.
- FFmpeg Filters Documentation (crop filter)依据: The crop filter takes width:height:x:y, where x and y locate the top-left corner of the crop window and expressions like in_w are supported.
最后验证: 2026-09-18 · 分类: 媒体