1

I want to use ffmpeg to cut a video file at some exact frame.

Let's take this video. First, I get a frame at 25 second:

ffmpeg -i sintel_trailer-1080p.mp4 -ss 25 -vframes 1 25.png

Note that I use postfix -ss option, so seeking must be frame accurate. Here's my image:

enter image description here

Then I cut the video at 25 second using stream copy and check its first frame:

ffmpeg -i sintel_trailer-1080p.mp4 -ss 25 -c copy cut.mp4
ffmpeg -i cut.mp4 -vframes 1 0.png

The first frame is different:

enter image description here

But if I replace stream copy option with some other format or video codec, the first frame is correct:

ffmpeg -i sintel_trailer-1080p.mp4 -ss 25 -f avi cut.avi
ffmpeg -i cut.avi -vframes 1 0_1.png

enter image description here

Is it possible at all to get frame accurate seeking with stream copy mode?

In my application user should be able to pick a frame and start a process that will cut video exactly at that frame. In this case I don't need any video conversion but at the same time I can't make stream copy mode to be frame accurate.

hank
  • 161

0 Answers0