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.
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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With