16

I create a video from image frame, and it work great. The problem is that I don't want to use all the image in my folder. I have 200 frames in my folder, but I want a video from 1 to 100

How I can speficy the frame count or the frame end?

ffmpeg -start_number n -i test_%d.jpg -vcodec mpeg4 test.avi

I can't find how

Thanks!

  • I don't know much about this program, but if it's using every image in a particular folder, why not create a new folder and only put in the 100 frames you want? – philipthegreat Dec 13 '13 at 16:21
  • 2
    That be will my "hack solution" if can't do it with ffmpeg :) – DarkPixel Dec 13 '13 at 16:41
26

You do this by stating the number of frames you want:

-vframes 100  

So effectively it is in your case:

ffmpeg -start_number 1 -i test_%d.jpg -vframes 100 -vcodec mpeg4 test.avi

You might need to specify other parameters such as pix_fmt etc depending on other factors.

Also, usually one uses something like test_%05d.jpg with the numbered sequence having preceding zeroes and 5 digits. If you don't have it in that format you might need to use a globbing pattern. See this.

3

This is code that always works for me well.

ffmpeg -i yourfile.mp4 -r 1 -ss 15 -t 16 -f image2 snapshot.jpg
                                ^     ^ 
                                ^     ^
                              start  end
                               time   time

time is in seconds only. If it's 2 minute ahead of the reel, then it's 120. One image file always is one second worth, thus calculate your desire image by that approach.

yourfile.mp4 = your movie clip

snapshot.jpg = your new image file

IMPORTANT: leave image2 alone. It is only way to get what I wanted.

  • 4
    I appreciate this command, because it works with old ffmpeg which I have to use right now; the only thing is -t is not "end time", man ffmpeg states it is "duration"; so end time would be start+duration. Cheers! – sdaau Jan 26 '15 at 10:05

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.