Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: 2d animation

by zentara (Archbishop)
on Aug 15, 2011 at 15:41 UTC ( [id://920316]=note: print w/replies, xml ) Need Help??


in reply to 2d animation

If you already have a way to capture each frame, say a a jpg, you can use mencoder or ffmpeg to convert them into a movie. For example, this will take a series of jpg's , like 0000001.jpg, 0000002.jpg, etc
#create a small speed adjusted file mencoder "mf://*.jpg" -mf fps=60 -o output.avi -ovc lavc -lavcopts vco +dec=mpeg4
or with ffmpeg
ffmpeg -f image2 -i image%d.jpg video.mpg # This command will transform all the images from the current direct +ory # (named image1.jpg, image2.jpg, etc...) to a video file named video. +mp
You can google for assemble images to avi ffmpeg

Also see z-charcoal-video-converter for how to use these programs from Perl. In this one, I rip the movie to jpgs and audio, process each frame to a charcoal effect, then recombine them. It does audio too, but you don't need that. It does show how to run the commands thru Perl's system, and handling of the jpg filenames. It's preferrable to put the jpgs in a separate sub directory, since there can be so many of them.

Oops, I just read that you can't save the images to disk first, so that kind of blows my method above away; but if you could somehow feed the frames to ffmpeg in a realtime stream, you may have some luck. Google for ffmpeg capture streaming frames . In that train of thought, see Webcam Streaming to Perl/Tk with ffmpeg


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://920316]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-24 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found