如何使用ffmpeg快速分割批量视频?

时间:2014-04-09 04:12:13

标签: video ffmpeg

我有很多视频,所以我想自动拆分它们。它们将分为两部分:

  • 第1部分:15分钟
  • 第2部分:其余的

搜索了很多,但没找到。请帮忙。

1 个答案:

答案 0 :(得分:1)

使用-ss-t选项:

ffmpeg -i input -t 00:15:00 -codec copy output
ffmpeg -ss 00:15:00 -i input -codec copy output

来自FFmpeg documentation

   -ss position (input/output)
       When used as an input option (before "-i"), seeks in this input
       file to position. Note the in most formats it is not possible to
       seek exactly, so ffmpeg will seek to the closest seek point before
       position.  When transcoding and -accurate_seek is enabled (the
       default), this extra segment between the seek point and position
       will be decoded and discarded. When doing stream copy or when
       -noaccurate_seek is used, it will be preserved.

       When used as an output option (before an output filename), decodes
       but discards input until the timestamps reach position.

       position may be either in seconds or in "hh:mm:ss[.xxx]" form.

   -t duration (output)
       Stop writing the output after its duration reaches duration.
       duration may be a number in seconds, or in "hh:mm:ss[.xxx]" form.

       -to and -t are mutually exclusive and -t has priority.

该示例使用-codec copy来使用stream copy模式而不是重新编码。