kscript has asked for the wisdom of the Perl Monks concerning the following question:

As simply as possible...

Is there a module that can generate video from text commands (like SDL)? I've seen modules that can play video, but none that can record it.
Let me know if you can find anything

Replies are listed 'Best First'.
Re: How to generate video in Perl
by Joost (Canon) on Sep 03, 2007 at 22:40 UTC
      More specifically, I'm looking for something like SDL, where you can add objects and render them on a surface. I've searched for "generating video", "video generation", "video generator", but the social networking craze clogged out anything that might be of use, and most of CPAN's video modules are poorly documented.

      OpenGL might be of use, but I'm not quite sure whether I need 3D capabilities just to write some text to a screen and render it.

      If All Else Fails, there might be a C/C++ library that I could use.
        I've been playing with SDL for awhile, but have not had much luck with video surfaces. Only thing I've been able to accomplish is a seg fault.

        I have a feeling that if you are trying to overlay or watermark video, your going to have an easier time using an off the shelf OSS solution.

        Here's one that looks promising, it actually does use SDL and V4L. I'll have to check it out myself.

        http://effectv.sourceforge.net/

        -Lee
        "To be civilized is to deny one's nature."
Re: How to generate video in Perl
by mmmmtmmmm (Monk) on Sep 04, 2007 at 04:57 UTC
    You might also want to read a bit about PDL - the Perl Data Language, as it is used often to perform efficient 3d graphics computations. There is also a OpenGL interface for PDL called PDL::Graphics::OpenGL.

    What exactly are you trying to do? How complex are you wanting this to be? Do you want something simple -- similar to a GIF or Flash animation? Or do you want high-resolution, fancy 3D letters with dynamic lighting effects, performing complex acrobatics? How is it going to be viewed? On a web page -- through a browser? Is it encoded as a video file? Or are you writing an application to render and display the video?

    Perl OpenGL (POGL) would be a good choice for complex 3D graphics. SDL::OpenGL is another option, however POGL tends to perform better in benchmark tests. Here is an excellent series of articles on 3D graphics programming in Perl:

    Building a 3D Engine

    If you just want simple animations check out some of the SVG modules for Perl. And there is a book on this by the way -- "Graphics Programming For Perl" from Manning Publications, which I have not read, but which has decent reviews. Here are some links for SVG:

    Introduction To Scalable Vector Graphics
    Creating Scalable Vector Graphics With Perl

    ---mmmmtmmmm
Re: How to generate video in Perl
by zentara (Cardinal) on Sep 04, 2007 at 13:20 UTC
    If you want to record (or create from individual frames) use mencoder ( part of the mplayer package). You can see how it can be controlled from Perl in ztk-v4l-video-bloger/recorder and a rip-process-reassemble can be seen in z-charcoal-video-converter

    Also you can search google and groups.google for mencoder, to find the difficult syntax strings to do what you want. Mencoder can be VERY FINICKY about syntax.

    I'm not sure what you mean by create video from text commands.


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: How to generate video in Perl
by Anonymous Monk on Sep 04, 2007 at 07:24 UTC
Re: How to generate video in Perl
by fenLisesi (Priest) on Sep 04, 2007 at 08:08 UTC
    The frozen bubble code might possibly help you as an example working Perl code that drives SDL. I really haven't studied it, though. Just played it a lot =). Cheers.
Re: How to generate video in Perl
by Anonymous Monk on Sep 04, 2007 at 11:38 UTC