ffmpeg 中的 -ss 和 -itsoffset 有什么区别?

ffmpeg 中的 -ss 和 -itsoffset 有什么区别?

ffmpeg 对此的描述如下:

‘-ss position (input/output)’
When used as an input option (before -i), seeks in this input file to position. When used as an output option (before an output filename), decodes but discards input until the timestamps reach position. This is slower, but more accurate.
position may be either in seconds or in hh:mm:ss[.xxx] form.

‘-itsoffset offset (input)’
Set the input time offset in seconds. [-]hh:mm:ss[.xxx] syntax is also supported. The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by offset seconds.

那么,当两者都用作输入选项时,两者有什么区别?当-ss用作时,它们是否相同input option

答案1

那么,当两者都作为输入选项时,两者有什么区别呢?

  • 命令

    ffmpeg -ss 5 -i inputfile outputfile
    

    丢弃前五秒的输入。

    如果输入文件长 60 秒,则输出文件长将为 55 秒。

  • 命令

    ffmpeg -itsoffset 5 -i inputfile outputfile
    

    延迟输入文件的视频流速为 5 秒。

    如果输入文件长度为 60 秒,则输出文件长度将为 65 秒。前 5 秒将是静止图像(第一帧)。

  • 命令

    ffmpeg -itsoffset -5 -i inputfile outputfile
    

    推进输入文件的视频流速为 5 秒。

    与 类似-ss 5,这会丢弃输入的前五秒。但是,如果您的输入文件长度为 60 秒,则输出文件长度也将为 60 秒。最后 5 秒将是静止图像(最后一帧)。

总而言之,裁剪-ss输入同时-itsoffset可用于同步视频和音频流。

相关内容