# Animations - formats other than GIF

**URL:** <https://discourse.julialang.org/t/animations-formats-other-than-gif/32931>\
**Category:** Visualization\
**Tags:** plots, animations\
**Created:** [January 3, 2020, 4:31pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931 "2020-01-03T16:31:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [January 3, 2020, 4:31pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/1 "2020-01-03T16:31:35Z")

</div>

I’m currently using Plots to generate graphics, including some animations. The docs make it easy to create animated GIFs but for my purposes I’d prefer an alternate output format such as .mov

Any tips or suggestions on how to do this easily? Is there a way within Plots or some other Julia package?

Thanks for any tips.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 3, 2020, 4:46pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/2 "2020-01-03T16:46:33Z")

</div>

The answer probably involves `ffmpeg`, which is how a lot of animations are made. Packages vary as to where and how `ffmpeg` fits into the tool chain. [VIdeoIO](https://github.com/JuliaIO/VideoIO.jl) provides access. It might depend on how you want to create the image stack which is the input to `ffmpeg`.

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [January 3, 2020, 4:57pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/3 "2020-01-03T16:57:35Z")

</div>

I’m assuming I’ll create frames (images) using Plots and saving each one individually; it sounds like VideoIO can help then turn that sequence of images into a movie.

Is that the “state of the art” package for doing so?

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [January 3, 2020, 5:49pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/4 "2020-01-03T17:49:57Z")

</div>

```julia
using Plots
gr() 
x = 0:0.01:2*pi
anim = @animate for i in 1:200
    plot(x, sin.(x .+ i / 10.0), legend = false, size = (400,200))
    end every 2 ;
gif(anim,"anim.gif") # then you can also change to .mp4 or .mov
#gif(anim,"anim.mp4") # this one usually works. If not, 
#then you need to check ffmpeg. 

```

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [January 3, 2020, 6:09pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/5 "2020-01-03T18:09:28Z")

</div>

> [@lazarusA](#):
>
> gif(anim,“anim.gif”) # then you can also change to .mp4 or .mov #gif(anim,“anim.mp4”) # this one usually works. If not, #then you need to check ffmpeg.

I’d forgotten I’d seen this somewhere - but I did look at the Plots docs this morning under the topic of animations, and it does not mention any other options than GIF ([Animations · Plots](http://docs.juliaplots.org/latest/animations/)). 🙂 I’ll try this again, but I have a vague memory of having issues with the generated mp4 files (wouldn’t play on my system or something).

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [January 3, 2020, 6:46pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/6 "2020-01-03T18:46:49Z")

</div>

[Here](https://discourse.julialang.org/t/having-problems-with-creating-animations-with-plots-jl-grbackend-juno/21876/2) is an example how to invoke ffmpeg manually to get other outputs.

---

<div class="post-metadata">

**Author:** ![lwhitefox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwhitefox/32/4363_2.png) [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Post date:** [January 8, 2020, 4:28pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/7 "2020-01-08T16:28:51Z")

</div>

I had to move away from this was for a few days, but I wanted to reply - thanks for the examples.

I’d hoped to avoid manual ffmpeg invocation, but it is an option too!

---

<div class="post-metadata">

**Author:** ![IlyaOrson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ilyaorson/32/1681_2.png) [@IlyaOrson](https://discourse.julialang.org/u/IlyaOrson)\
**Post date:** [January 8, 2020, 9:57pm UTC](https://discourse.julialang.org/t/animations-formats-other-than-gif/32931/8 "2020-01-08T21:57:40Z")

</div>

[Gifski](https://gif.ski/) is **very** efficient to create gifs from png files. You could also use the [ImageOptim](https://imageoptim.com/api/ungif) web service via [HTTP.jl](https://github.com/JuliaWeb/HTTP.jl) to transform gifs to more efficient video files.
