ffmpeg is a wonderful library for creating video applications or even general purpose utilities. ffmpeg takes care of all the hard work of video processing by doing all the decoding, encoding, muxing and demuxing for you. This can make media applications much simpler to write. It's simple, written in C, fast, and can decode almost any codec you'll find in use today, as well as encode several other formats.
Installation:
OpenSuSe user can use "1-click" installer to install ffmpeg - here
Ubuntu user can install ffmpeg using command: sudo apt-get install ffmpeg
Extracting images from a video:
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpegThis 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.
Creating a video from many images:
ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.aviThe 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.
3 comments:
Man, all those conversions with one application! Neater than sneakers!
Hi,
I'm making a movie from images using ffmpeg. I need a command that will allow me to grab images starting from img_1013.jpg (or any other name, but not 01, 02, etc..). Do you know if there's such command in ffmpeg?
For this you need to write a simple script (bash) to provide the files to fmpeg command in the way you wnated.
Post a Comment