Png files to mp4

Dear All,

how can I converts pngs files (fig1.png, fig2.png, … , fig10.png) to mp4. video using a very easy method in Julia?

Best regards

I am not sure why you think Julia is the right tool for this task. Just use an external program. You can of course call it from Julia.

Sure, I want to find a similar package in Julia, e.g. (Matlab)

writerObj = VideoWriter('test.avi');

open(writerObj);

for K = 1 : 10000

filename1 = sprintf('%d.png', K);

thisimage1 = imread(filename1);

writeVideo(writerObj, thisimage1);

end

close(writerObj);

I assume you’re trying to animate a sequence of plots as described in your earlier post? Plots.jl has a built-in animation utility: Animations · Plots
(note that you can save a .mp4 by calling mp4(anim, “path/to/savedir/animation.mp4”, fps=30) )

1 Like

HI @stillyslalom

thanks a lot for your support!

how about VideoIO.jl?

best

Unfortunately, VideoIO.jl is only capable of video input, not output (at least as of the last time I checked). See: https://github.com/JuliaIO/VideoIO.jl/issues/36
The most versatile option is, as Tamas mentioned, calling an external program, which is the approach taken by https://github.com/yakir12/FFmpegPipe.jl. If you need more control, you can build your own ffmpeg command pipe as I did here.

2 Likes

Use ffmpeg and call it from Julia if you want to.

https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg

sure , I can also make a video file in terminal using ffmpeg command