I want to cut a video using ffmpeg.

This is the command I used.

ffmpeg -ss 1:40 -t 0:40 -i "1.ts" -c copy 100sts.ts

Duration of the result file is 1m 43s.

I guessed there is no keyframe in that section, but I was wrong.

Below is the list of the command I typed, and duration of them respectively.

ffmpeg -ss 1:40 -t 0:30 -i "1.ts" -c copy 100sts_2.ts
ffmpeg -ss 1:40 -t 0:10 -i "1.ts" -c copy 100sts_3.ts
ffmpeg -ss 1:40 -to 2:20 -i "1.ts" -c copy 100sts_4.ts
ffmpeg -ss 1:40 -to 1:50 -i "1.ts" -c copy 100sts_5.ts
ffmpeg -ss 1:40 -to 1:41 -i "1.ts" -c copy 100sts_6.ts
1min 30s
1min 13s
1min 43s
1min 13s
1min 4s

I want to cut this video so that its duration would be around 30~40s.

But ffmpeg is cutting it 1 min more than specified time. What have i done wrong?


Idk know why you are having this issue, but a basic thing to try in sour code line it's switch the position of time parameters to input, like this:

ffmpeg -i input.ts -c copy -ss 1:40 -t 0:40 40s_ts.ts

For FFmpeg really matter the order, so try do in this order, other thing which you can do it's try trimming use the -vf filter

ffmpeg -i input.ts -c copy -vf "trim=50:150" 50s_ts.ts

In this case the defaults are all the input is kept. So it is possible to set just the end values to keep everything before the specified time. So you are telling to ffmpeg "give me the final 50 seconds from 150 seconds of the input" if this don't work, maybe you'll need write in a verbose way: -vf "trim=start=100,duration=50"

  • 1
    Also try putting -i flag last
    – qwr
    Dec 31 '21 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.