ffmpeg convert video from specified time period sl

2020-07-20 05:14发布

问题:

For example: If I convert video like this:

ffmpeg -i demo.avi -ss 00:00:05 -t 00:00:15 test.flv

it's fast

ffmpeg -i demo.avi -ss 00:45:05 -t 00:00:15 test.flv

I have to wait a long time before it actually works.

Any way to fix that?

回答1:

The behavior of -ss depends upon where it is placed in the command: as an input or output option. As the ffmpeg documentation states:

-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 outputfilename), 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.

You can also use -ss as an input option and an output option which may the provide both speed and (possibly increased) accuracy. See [FFmpeg-user] Reducing seek time when start time offset (-ss) is large and comments on Enhancing -ss option for more examples and details.



标签: video ffmpeg