tConvert animations to mp4 with ffmpeg if available - Granular.jl - Julia package for granular dynamics simulation
 (HTM) git clone git://src.adamsgaard.dk/Granular.jl
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0fc41a6f811b5970151c7960686a4e6d1e9603bc
 (DIR) parent eb7cdca84697284acd902a7c63846255851291f2
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Mon,  7 May 2018 16:06:13 -0400
       
       Convert animations to mp4 with ffmpeg if available
       
       Diffstat:
         M src/io.jl                           |      16 +++++++++++++++-
       
       1 file changed, 15 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/io.jl b/src/io.jl
       t@@ -1067,7 +1067,8 @@ from the shell using the supplied `pvpython` argument.
        * `images::Bool`: render images to disk (default: true)
        * `gif::Bool`: merge images as GIF and save to disk (default: false, requires
            `images=true`)
       -* `animation::Bool`: render animation as AVI to disk (default: false)
       +* `animation::Bool`: render animation as movie to disk (default: false). If
       +    ffmpeg is available on the system, the `.avi` file is converted to `.mp4`.
        * `trim::Bool`: trim images in animated sequence (default: true)
        * `reverse::Bool`: if `images=true` additionally render reverse-animated gif
            (default: false)
       t@@ -1084,6 +1085,19 @@ function render(simulation::Simulation; pvpython::String="pvpython",
            try
                run(`$(pvpython) $(simulation.id)/$(simulation.id).py`)
        
       +        if animation
       +            try
       +                run(`ffmpeg -i $(simulation.id)/$(simulation.id).avi 
       +                    -vf scale='trunc\(iw/2\)\*2:trunc\(ih/2\)\*2' 
       +                    -c:v libx264 -profile:v high -pix_fmt yuv420p 
       +                    -g 30 -r 30 -y 
       +                    $(simulation.id)/$(simulation.id).mp4`)
       +                if isfile("$(simulation.id)/$(simulation.id).mp4")
       +                    rm("$(simulation.id)/$(simulation.id).avi")
       +                end
       +            end
       +        end
       +
                # if available, use imagemagick to create gif from images
                if images && gif
                    try