FORUMS: list search recent posts

extracting images

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Robertson
extracting images
on Apr 7, 2012 at 10:41:06 pm

Is there a way to extract say 900 frames at intervals of 4 minutes for a video that is 1 hour long so that the output could then be used to create a new (shorter) video?

Pedro


Return to posts index

stephen dixon
Re: extracting images
on Apr 9, 2012 at 3:29:53 pm

from the ffmpeg online manual:

ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
This will extract one video frame per second from the video and will output them in files named ‘foo-001.jpeg’, ‘foo-002.jpeg’, etc. Images will be rescaled to fit the new WxH values.

If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time.


I'm not sure if it will work with numbers other than integers, but you could try using r -0.0001667 (I had a test with ffmbc and even -r 1 didn't work so YMMV)

Or you could use the shell with a loop and a variable to just extract 1 frame at a given time. I'm not sure what environment you're in, but with bash on linux/os x you'd do something like:

for i in {0..900};
f=$(( i * 240 )) # (240 because it's 60 seconds * 4)
do ffmpeg -i foo.avi -vframes 1 -ss $f -f image2 foo-$f.jpeg
done


Return to posts index

Peter Robertson
Re: extracting images
on Apr 11, 2012 at 5:56:27 pm

I'm using a windows command line--I'm not sure what the syntax would be for the above???

Thanks.

Pedro


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]