Saber Karimi
Saber Karimi

Reputation: 21

FFMPEG "-to" option won't stop encoding at the implied time

I'm using ffmpeg to cut and covert a part of a long video but when using the "-to" option ffmpeg keeps encoding till the end of the video and wont stop.

Here's my command:

ffmpeg -ss 00:22:59 -i input.mkv -to 00:23:15.5 -c:v libx264 -c:a aac output.mp4

if i change to "-t" and enter my desired duration, problem goes away. but since i have a very long video and many tasks i need to use "-to" which is easier for me.

Thanks in advance.

Upvotes: 2

Views: 1756

Answers (1)

Gyan
Gyan

Reputation: 93068

Basically, -ss when used as an input option, seeks to the given time and resets timestamps, so that the first selected frame has timestamp 0. So, in your command, t and to will have the same effect.

You have to either use

ffmpeg -ss 00:22:59 -copyts -i input.mkv -to 00:23:15.5 -c:v libx264 -c:a aac output.mp4

(not recommended)

or

ffmpeg -ss 00:22:59 -to 00:23:15.5 -i input.mkv -c:v libx264 -c:a aac output.mp4

(needs ffmpeg build > Nov 19 2017)

or

ffmpeg -i input.mkv -ss 00:22:59 -to 00:23:15.5 -c:v libx264 -c:a aac output.mp4

(slowest of the three)

Upvotes: 2

Related Questions