Save animation with Luxor.jl

The documentation contains quite a lot of information:

http://juliagraphics.github.io/Luxor.jl/stable/howto/animation/

There’s

The creategif option for the animate function runs ffmpeg 
when the frames have all been generated.

and there’s

function main()
    databuffer = zeros(ARGB32, 250, 250)
    demo = Movie(250, 250, "buffer")
    animate(demo, [
            Scene(demo, (s, f) -> frame(s, f, databuffer),
                0:100)
        ],
        tempdirectory="/tmp/tempdir",
        creategif=true, 
        pathname="/tmp/t.gif")
end

where you can ask for a GIF and specify the pathname.

and there’s

...
tempdirectory = "/tmp/temp/"

animate(movie, [
        Scene(movie, frame, 1:50)
    ], 
    creategif=false, # don't have to create the GIF here
    tempdirectory=tempdirectory)

# run a custom ffmpeg command
FFMPEG.ffmpeg_exe(`-r 30 -f image2 -i $(tempdirectory)/%10d.png -c:v libx264 -r 30 -pix_fmt yuv420p -y /tmp/animation.mp4`)

where you can run FFMPEG to make an MP4.

Basically what you’re doing with animate() is creating a list of PNG files, with the option of running FFMPEG.

There are alternative ways of stitching PNG files together. For example, you can load them into a movie making application, or use something like Gifbrewery, which has a nifty Stitch feature.

1 Like