sleap.io.videowriter#

Module for writing avi/mp4 videos.

Usage:

> writer = VideoWriter.safe_builder(filename, height, width, fps)
> writer.add_frame(img)
> writer.close()
class sleap.io.videowriter.VideoWriter(filename, height, width, fps)[source]#

Abstract base class for writing avi/mp4 videos.

static safe_builder(filename, height, width, fps)[source]#

Builds VideoWriter based on available dependencies.

class sleap.io.videowriter.VideoWriterOpenCV(filename, height, width, fps)[source]#

Writes video using OpenCV as wrapper for ffmpeg.

class sleap.io.videowriter.VideoWriterSkvideo(filename, height, width, fps, crf: int = 21, preset: str = 'superfast')[source]#

Writes video using scikit-video as wrapper for ffmpeg.

filename#

Path to mp4 file to save to.

height#

Height of movie frames.

width#

Width of movie frames.

fps#

Playback framerate to save at.

crf#

Compression rate factor to control lossiness of video. Values go from 2 to 32, with numbers in the 18 to 30 range being most common. Lower values mean less compressed/higher quality.

preset#

Name of the libx264 preset to use (default: “superfast”).