26 April 2011

Converting a video to individual images


If the video is received in .camrec , use camtasia to convert to .avi (no need to include audio).

If in other format, then convert to .avi


Then run this command:

# ffmpeg -i INPUT.avi  -r 0.5  -f image2 OUTPUT-%03d.jpg
OR
# ffmpeg -i INPUT.avi  -r 0.5 -s WxH -f image2 OUTPUT-%03d.jpg  (need to specify WxH)


I got the command from the ffmpeg man page:

------------
 You can extract images from a video:

           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.

       The syntax "foo-%03d.jpeg" specifies to use a decimal number composed
       of three digits padded with zeroes to express the sequence number. It
       is the same syntax supported by the C printf function, but only formats
       accepting a normal integer are suitable.

       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.

--------------


video to images pictures frames photos extract linux
Too Cool for Internet Explorer