FFmpeg 无重编码截取视频片段

直接复制已有码流来截取视频时间段,几秒即可完成,且画质与原片完全一致。

Linux视频FFmpegcut 文本截取裁剪低风险
执行 ffmpeg -ss 00:02:30 -to 00:05:00 -i input.mp4 -c copy output.mp4 即可瞬间截取 02:30 至 05:00 的片段,无画质损失。

01命令

命令
$ ffmpeg -ss 00:02:30 -to 00:05:00 -i input.mp4 -c copy output.mp4

02作用说明

把 -ss 放在 -i 之前,ffmpeg 会直接跳到目标时间点,而不用先解码之前的内容,因此即使截取两小时的文件也只需几秒。-c copy 表示原样复制压缩数据,不重新编码、不损失画质。代价是切割点会对齐到最近的关键帧,起点可能偏差零点几秒;只有需要逐帧精确时才值得付出全片重编码的代价。

03风险

风险低风险
使用条件ffmpeg
!注意: 使用 -c copy 时切割点会对齐到关键帧;如需逐帧精确裁剪,请去掉 -c copy 并接受重新编码。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • FFmpeg Wiki: Seeking
    FFmpeg · community · 2026-09-17
    依据: Explains -ss before input for fast seeking and that -c copy cuts at keyframes without re-encoding.
  • FFmpeg Documentation
    FFmpeg · vendor-doc · 2026-09-17
    依据: Official documentation of the -ss, -to, and -c copy options.

最后验证: 2026-09-17 · 分类: 媒体