8

I use this to cut a part out of a mp4 file:

ffmpeg -i input.mp4 -vcodec copy -acodec copy -ss 00:36:18 -to 00:39:50 output.mp4

It works good but the video image is always freezed in the beginning for 1 second.

Doesnt matter which video file I try and cut a part out of, it takes like 1 second before the video start.

Heres an example:

Why?

1
  • It seems your youtube link is down, could you please keep the example live such that the question remains useful for future visitors? Oct 18, 2015 at 12:41

3 Answers 3

8

The order of the parameters is very important on ffmpeg.
Try this:

ffmpeg -ss 00:36:18 -i input.mp4 -vcodec copy -acodec copy -to 00:39:50 output.mp4

It seems that setting the -ss parameter before -i sets a keyframe at the beginning of the newly generated video.
Or so I understand from the Wiki page here.

2
  • 1
    Minor note: That's the wiki, not the official documentation. The wiki articles are written by users to supplement the docs, so they may contain less accurate information.
    – llogan
    Oct 17, 2015 at 17:55
  • This was the answer which helped me to solve the issue.
    – Amessihel
    Nov 7, 2020 at 17:24
3

The video freezes because you aren't cutting at an I-frame, while using stream-copy mode. You'll have to re-encode the video, or choose a different start point, which happens to be an I-frame.

3
0

What works for me was:

ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c:v libx264 -c:a aac cut.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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