8

I know video can't be turned directly into a motion JPEG but what I'm after is for each frame in a sequence to be taken from the video and turned into a JPEG sprite either horizontal or vertical.

I'll then be using jQuery to animate the jpeg sprite into what looks like a video again.

bcsb1001
  • 2,834
  • 3
  • 24
  • 35
The Angry Saxon
  • 792
  • 2
  • 7
  • 24

2 Answers2

29

You can turn a movie into a stitched together sprite file by doing the following:

1) Use ffmpeg to turn the movie into a bunch of images (this example uses 10 fps)

ffmpeg -i "infile.mp4" -f image2 -vf fps=fps=10 img%03d.jpg

2) Then use imagemagick to stitch them together

files=$(ls img*.jpg | sort -t '-' -n -k 2 | tr '\n' ' ')
convert $files -append output.jpg

BOOM - you've got a sprite sheet.

Chris O'Sullivan
  • 1,232
  • 16
  • 21
3

You can use ffmpeg to extract frames into images. The following command pulls a single frame five seconds in:

ffmpeg -i "infile.mp4" -r 1 -ss 00:00:05 -t 00:00:01 -vframes 1 -f image2 -y "image.jpg"

knabar
  • 1,167
  • 1
  • 8
  • 12
  • Legend!! This looks or rather sounds exactly what I'm after. Do you know of a screen capture tool that this would be able to read the results from as well? – The Angry Saxon Mar 29 '12 at 23:04
  • Not to worry I've found a free software called camstudio that creates avi of screen. Thanks again :) – The Angry Saxon Mar 29 '12 at 23:12