Ok I can post here a simplified version of my code:
using Printf
using Luxor
Function draw
to create a simple drawing (rectangle with number inside; the number comes from an external output
):
function draw(output,framenumber)
# Settings
x0 = 70; y0 = 100
background("white")
sethue("black")
fontsize(20)
# Reactangle
rect(Point(x0-200,y0-200), 200, 200, action=:stroke)
strokepath()
# Output
Luxor.text(string(@sprintf("%.0f",output[framenumber])),
Point(x0-100,y0-100),
halign=:center)
end
Function frame
that calls draw
to produce each single frame of the animation (scene.opts
is needed to pass to draw
the vector output
):
function frame(scene, framenumber)
# Draw the figure
draw(scene.opts,framenumber)
end
Vector output
and movie
definitions:
output = 100:150
movie = Movie(800, 800, "name_movie", 1:10)
An animation is produced using Luxor.animate
function (optarg=output
is needed to pass the external output
):
anim = Luxor.animate(movie,
[Scene(movie, frame, 1:10, easingfunction=easeinoutcubic, optarg=output)],
tempdirectory=pwd(),
creategif=false,
pathname=string(pwd(),"/video.gif"))
Now, with tempdirectory=pwd()
I can save all ten frames as .png images in my current directory.
With creategif=true
I produce an animation visualised in Julia Plots space and saved in pathname
with the specified name (video.gif
). Indeed I see the animation in Julia Plots space and I save a file named video.gif
, however that file is not an animation but only a collection of .png images. How to convert it into a real gif or a video (.mp4 or similar)? Even by changing pathname
to something like video.mp4
or others does not work.
I also tried to use FFMPEG
package, but with no result at all (nothing is produced nor saved):
using FFMPEG
FFMPEG.ffmpeg_exe(`-r 30 -f image2 -i $(pwd())/%10d.png -c:v libx264 -r 30 -pix_fmt yuv420p -y /tmp/animation.mp4`)
Do you see any mistake or do you have any suggestion?