On 23/12/2009 7:13 AM, Rainer M Krug wrote:


On Tue, Dec 22, 2009 at 8:10 PM, Duncan Murdoch <murd...@stats.uwo.ca <mailto:murd...@stats.uwo.ca>> wrote:

    On 22/12/2009 12:49 PM, Mark Knecht wrote:

        On Mon, Dec 21, 2009 at 4:42 AM, Duncan Murdoch
        <murd...@stats.uwo.ca <mailto:murd...@stats.uwo.ca>> wrote:
         > I've just posted a demo made with the rgl package to Youtube,
        visible here:
         >  http://www.youtube.com/watch?v=prdZWQD7L5c
         >
         > For future reference, here are the steps I used:
         >
         > 1.  Design a shape to be displayed, and then play with the
        animation
         > functions to make it change over time.  Use play3d to do it
        live in R,
         > movie3d to write the individual frames of the movie to .png
        files.
         >
         > 2.  Use the ffmpeg package (not an R package, a separate
        project at
         > http://ffmpeg.org) to convert the .png files to an .mp4 file.
         The
         > individual frames totalled about 1 GB; the compressed movie
        is about 45 MB.


Could you please post the command line options you used for ffmpeg? I remember I wanted to do an animation, also from .png, and I struggled a lot.

Sure. The png files were 1024 by 768, designed to be displayed at 24fps. The command line was

ffmpeg  -b 2400000 -r 24 -i movie%03d.png -s xga movie.mp4

The -b option controls the target bit rate. The -r option says how many frames per second, -i includes all the files (named things like movie001.png, etc.), -s sets the output size, with xga being a quick way to say 1024x768, and movie.mp4 is the output file. There are tons of options to change codec, etc., but I found the -b option was the only one I needed to play with.

Duncan Murdoch


Rainer
         > 3.  Upload to Youtube.  I'm not a musician, so I had to use
        one of their
         > licensed background tracks, I couldn't write my own.  I spent
        a lot of time
         > picking one and then adjusting the timing of the video to
        compensate.  Each
         > render/upload cycle at full resolution took about an hour and
        a half.  It's
         > a lot faster to render in a smaller window with fewer frames
        per second, but
         > it's still tedious.   It's easier to synchronize if you
        actually have a copy
         > of the music locally, but Youtube doesn't let you download
        their music.  So
         > the timing isn't perfect, but it's good enough for me!
         >
         > Duncan Murdoch
         >

        Cool enough video. Thanks for sharing.

        I'm curious - did you do the equations for the knot in R? If so what
        did they look like, assuming there's no reason you cannot share it.

    The knot has equation

    cbind(sin(theta)+2*sin(2*theta), 2*sin(3*theta),
    cos(theta)-2*cos(2*theta))

    The threads in the braid have equation

    cbind(sin(theta) + sin(2*theta)/2, sin(theta-pi) + sin(2*theta)/2,
    theta)

    in the local coordinates of the knot.

    Overall it's about 100 lines of R code, too ugly to post.

    Duncan Murdoch


    ______________________________________________
    R-help@r-project.org <mailto:R-help@r-project.org> mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide
    http://www.R-project.org/posting-guide.html
    and provide commented, minimal, self-contained, reproducible code.




--
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:           +27 - (0)83 9479 042
Fax:            +27 - (0)86 516 2782
Fax:            +49 - (0)321 2125 2244
email:          rai...@krugs.de <mailto:rai...@krugs.de>

Skype:          RMkrug
Google:         r.m.k...@gmail.com <mailto:r.m.k...@gmail.com>


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to