How to record a video from PImages/sketch?

edited October 2013 in How To...

Hello,

I was searching and discovered I could use MovieMaker class to save a bunch of PImages into a video clip. I also find out that Processing doesn't support anymore this class, so I wondered what alternatives do I have.

Thanks very much!

Answers

  • One alternative would be to use saveFrame() at the end of draw(). Then later assemble all frames together in a movie using some tool like quicktime 7. No audio this way though...

  • edited October 2013

    Thanks for the answer. I don't want to record audio, but I wanted to record while the application is running. If there's anything that could do the job that would be great.

  • _vk_vk
    edited October 2013

    I didn't get what do you mean by "while application". The above method will record during app execution. Is this what you mean? The "later" is to transform a sequence of numbered frames in a movie. The saveFrame() will save one frame each interaction of your draw, like: "coolFrame0001.jpg", "coolFrame0002.jpg"... This is usually called "image sequence" and is a very common in video industry. In qt7 you go trough "File" menu and choose "open Image Sequence". Than shows it the first frame and chooses a frame rate, and you are done. Than you can save it in any codec you need. This works 4 you? ps qt7 is free.

  • Can I do that with code? I want my application to do that automatically (even if I need to save the PImages into the hardrive before doing that).

  • Humm I see... don't know. Maybe you can look for Java video libraries...

  • I thought GSVideo could do something like that. I was going to look into it, but I don't think it is updated to Processing 2. It may or may not work with 2.

  • Answer ✓

    The simpliest way to do that probably would be still to use saveFrame() in your app, and then before the app is finished, call ffmpeg command line utility to convert your images into video.

    Here youcan download ffmpeg command line utility

    http://www.ffmpeg.org/download.html

    and here're specific instructions of how to make video from sequence of images.

    https://trac.ffmpeg.org/wiki/Create a video slideshow from images

  • Is there a way to call the command line from within a sketch? How hard would that be to do, if it is possible?

  • you can use this processing command: processing.org/reference/open_.html

    or use directly java Runtime.exec() method

    here's the thread from old old old processing forum which seems to explain how to do that

    processing.org/discourse/beta/num_1244736039.html

    It's a bit more than 1 line of code, but still simple.

  • @dimkir Yes, thank you. I'm going to play around with this.

Sign In or Register to comment.