Convert Video into JPEG Sprite
Solution 1
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.
Solution 2
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"
The Angry Saxon
Freelance web developer based in Kent. Work within Visual Studio 2003-2015, coding with VB and C# .Net 1-4.5. Experience in Classic ASP and push myself with new technologies daily. javascript frameworks, CSS preprocessors, CSS3 and HTML5 experience.
Updated on July 27, 2022Comments
-
The Angry Saxon almost 2 years
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.