ffmpeg time calculations

My previous post on the Time Calculator, mostly came about because I used the ffmpeg “-t” switch for ending time calculations. So if my desired clip began at one minute “-ss 00:01:00” and I wanted it to end at 5 min 20 sec. I would have to first subtract 01:00 from 5:20 to get “-t 04:20”. Other time subtractions are not so easy. However that post caused me to search for an better ffmpeg solution, that I was sure existed. And it does… simply use the “-to” switch instead. So…

-t is for clip duration
-to is for clip end time

The command for the above example would be…

ffmpeg -i “input.mp4” -ss 01:00 -to 05:20 -codec copy output.mp4

That’s why ffmpeg doesn’t accept the following command. But it will work if instead you use the “-t” switch

bill@bill-MS-7B79:~/Videos$ ffmpeg -i "input.mp4" -ss 00:00:30 -to 00:00:20 test.mp4
-to value smaller than -ss; aborting.
bill@bill-MS-7B79:~/Videos$ 

Leave a comment

Your email address will not be published. Required fields are marked *