pyguymer3.media.images2mp4

pyguymer3.media.images2mp4(imgs, /, *, cacheDir='~/.cache/pyguymer3', chunksize=1048576, crf=-1.0, debug=True, ensureNFC=True, ffmpegPath=None, ffprobePath=None, form='mp4', fps=25.0, level='ERROR', mp4filePath=None, pkgPath=None, portPath=None, profile='ERROR', screenHeight=-1, screenWidth=-1, timeout=60.0, zypperPath=None)[source]

Convert a sequence of images to a MP4 video.

This function makes a MP4 video from a list of file paths. The user is able to set the format and the framerate, as well as optionally downscaling the images to fit withing a screen size.

Parameters:
  • imgs (list of PIL.Image.Image or list of str) – the list of input PIL Images or list of paths to the input images

  • cacheDir (str, optional) – if a string, then it is the path to the local cache of “ffprobe” JSON output so as to save time in future calls

  • crf (float, optional) – the CRF to be passed to libx264, default -1.0 (which means choose one using the function return_x264_crf())

  • debug (bool, optional) – print debug messages

  • ffmpegPath (str, optional) – the path to the “ffmpeg” binary (if not provided then Python will attempt to find the binary itself)

  • ffprobePath (str, optional) – the path to the “ffprobe” binary (if not provided then Python will attempt to find the binary itself)

  • form (str, optional) – the format to be passed to ffmpeg, default “mp4” (the only two sensible options are “ipod” and “mp4”)

  • fps (float, optional) – the framerate, default 25.0

  • level (str, optional) – the level to be passed to libx264, default “ERROR” (which means choose one using the function return_x264_level())

  • mp4filePath (str, optional) – the path to the “mp4file” binary (if not provided then Python will attempt to find the binary itself)

  • pkgPath (str, optional) – the path to the “pkg” binary (if not provided then Python will attempt to find the binary itself)

  • portPath (str, optional) – the path to the “port” binary (if not provided then Python will attempt to find the binary itself)

  • profile (str, optional) – the profile to be passed to libx264, default “ERROR” (which means choose one using the function return_x264_profile())

  • screenHeight (int, optional) – the height of the screen to downscale the input images to fit within, default -1 (integers less than 100 imply no downscaling)

  • screenWidth (int, optional) – the width of the screen to downscale the input images to fit within, default -1 (integers less than 100 imply no downscaling)

  • timeout (float, optional) – the timeout for any requests/subprocess calls

  • zypperPath (str, optional) – the path to the “zypper” binary (if not provided then Python will attempt to find the binary itself)

Returns:

path – the path to the MP4 in a temporary directory (to be copied/moved by the user themselves)

Return type:

str

Notes

Copyright 2017 Thomas Guymer [1]

References