Video Splitting

PySceneDetect scenedetect.video_splitter Module

The scenedetect.video_splitter module contains functions to split videos with a scene list using external tools (e.g. mkvmerge, ffmpeg), as well as functions to check if the tools are available.

These functions are mainly intended for use by the PySceneDetect command line interface (the scenedetect command).

Certain distributions of PySceneDetect may include the above software. If using a source distribution, these programs can be obtained from following URLs (note that mkvmerge is a part of the MKVToolNix package):

If you are a Linux user, you can likely obtain the above programs from your package manager (e.g. sudo apt-get install ffmpeg).

Once installed, ensure the program can be accessed system-wide by calling the mkvmerge or ffmpeg command from a terminal/command prompt. PySceneDetect will automatically use whichever program is available on the computer, depending on the specified command-line options.


Is ffmpeg Available: Gracefully checks if ffmpeg command is available.

Returns:(bool) True if the ffmpeg command is available, False otherwise.

Is mkvmerge Available: Gracefully checks if mkvmerge command is available.

Returns:(bool) True if the mkvmerge command is available, False otherwise.
scenedetect.video_splitter.split_video_ffmpeg(input_video_paths, scene_list, output_file_template, video_name, arg_override='-c:v libx264 -preset fast -crf 21 -c:a copy', hide_progress=False, suppress_output=False)

Calls the ffmpeg command on the input video(s), generating a new video for each scene based on the start/end timecodes.

scenedetect.video_splitter.split_video_mkvmerge(input_video_paths, scene_list, output_file_prefix, video_name, suppress_output=False)

Calls the mkvmerge command on the input video(s), splitting it at the passed timecodes, where each scene is written in sequence from 001.