The Lab Book Pages

An online collection of electronics information

http://www.labbookpages.co.uk

Dr. Andrew Greensted
Last modified: 18th November 2009

Hide Menu


Valid XHTML Valid CSS
Valid RSS VIM Powered
RSS Feed Icon

This site uses Google Analytics to track visits. Privacy Statement

Page Icon

Video/Image Conversion

A few commands to help convert between images and video, very handy for creating sample data sets when writing image processing tools.


Extract Images from a Video

The simple command below takes a video file (video.mpg), extracts then outputs a series of images.

> ffmpeg -i video.mpg image%d.jpg

Combine Image into a Video

The command below will convert a set of PNG images (*.png) into a video (video.mpg). Note the printf like format int the image name.

> ffmpeg -i img%d.png video.mpg

Note: FFmpeg is very particular about the source image filenames. As of version 0.5, if the image names are too complex you'll get a segmentation fault. So, if you have a set of images with names like image_sample-0001-scaled.png, you can convert them to something more friendly using the following command.

> i=0; for img in image_sample*.png; do cp $img img$i.png; (( i++ )); done

References

The FFmpeg Logo

The FFmpeg Logo

The following links have some handy commands

The FFmpeg website has some great examples of use:


Book Logo