leniax.video package

leniax.video.render_video(save_dir, all_cells, render_params, colormaps, prefix='', transparent_bg=False)[source]

Render a Leniax video

ffmpeg
    -format='rawvideo',
    -pix_fmt='rgba',
    -s=f"{width}x{height}",
    -framerate=30,
    -i pipe:
    -c:v libx264
    -profile:v high
    -preset slow
    -movflags faststart
    -pix_fmt yuv420p
    out.mp4
Parameters
  • save_dir (str) – directory used to save assets.

  • all_cells (jax._src.numpy.ndarray.ndarray) – Simulation data of shape [nb_iter, C, H, W] .

  • render_params (Dict) – Rendering configuration.

  • colormaps (Union[List, Any]) – A List of matplotlib compatible colormaps

  • prefix (str) – Video name prefix

  • transparent_bg (bool) – Set to True to make the background transparent.

leniax.video.render_gif(video_fullpath)[source]

Render a video as a GIF

ffmpeg
    -i $video_fullpath
    -vf "fps=30,scale=width:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse"
    -loop 0
   \$video_fullpath.gif
Parameters

video_fullpath – Fullpath of a video.

Render a video from QD vizualisation

ffmpeg
    -framerate $framerate -i '%4d-emitter_0.png'
    -framerate $framerate -i '%4d-emitter_1.png'
    -framerate $framerate -i '%4d-emitter_2.png'
    -framerate $framerate -i '%4d-emitter_3.png'
    -framerate $framerate -i '%4d-archive_ccdf.png'
    -framerate $framerate -i '%4d-archive_heatmap.png'
    -filter_complex "[0:v][1:v]hstack[h1];
        [2:v][3:v]hstack[h2];
        [4:v][5:v]hstack[h3];
        [h1][h2]vstack[v1];
        [v1][h3]vstack[o]"
    -map "[o]"
    \$output_fullpath.mp4
Parameters
  • output_fullpath – Fullpath of the video file.

  • framerate – Frame rate of the video.