Loic Bch
Loic Bch

Reputation: 13

Split video in specific number of frame with ffmpeg in c#

I want to split a video into a specific number of image: I'm using ffmpeg/EmguCV in C#.

I capture a video from a webcam and i need to split the video into 59 images. i'm using -i command with ffmpeg to split my video into a number of images.

The problem is that the number of images i get at the end is different at each capture because the duration of the video is not exactly the same due to fps drop.

So if anyone know if it's possible to specify that i want the video to be equally cut into 59 images. (Or any other idea to get what i want)

(at the moment i'm taking the number of images i get from the cut and divide it by 59 then i'm taking one image in "the result" but i'ts not precise at all because if i get a decimal number im losing or adding images)

Upvotes: 1

Views: 1163

Answers (1)

Bhoomi
Bhoomi

Reputation: 41

You can try

ffmpeg -i D:/Temp/2.mp4 -r rate output_%04d.jpg

where rate = (Number Of images - 2 )/(Video duration in seconds)

Here we take "-2 " because it will automatically generate starting and ending images from video

Upvotes: 0

Related Questions