Home

Awesome

PySceneDetect

PySceneDetect (https://pyscenedetect.readthedocs.io/en/latest/) running on Debian 10 with Python 3.9.0.

Getting the image

Build on your own:

# docker build github.com/handflucht/PySceneDetect -t pyscenedetect:latest

or pull:

# docker pull handflucht/pyscenedetect

Usage

PySceneDetect is set as Entrypoint:

# docker run pyscenedetect -h
Usage: scenedetect [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

  For example:

  scenedetect -i video.mp4 -s video.stats.csv detect-content list-scenes

  Note that the following options represent [OPTIONS] above. To list the
  optional [ARGS] for a particular COMMAND, type `scenedetect help COMMAND`.
  You can also combine commands (e.g. scenedetect [...] detect-content save-
  images --png split-video).

Options:
  -i, --input VIDEO      [Required] Input video file. May be specified
                         multiple times to concatenate several videos
                         together.
  -o, --output DIR       Output directory for all files (stats file, output
                         videos, images, log files, etc...).
  -f, --framerate FPS    Force framerate, in frames/sec (e.g. -f 29.97).
                         Disables check to ensure that all input videos have
                         the same framerates.
  -d, --downscale N      Integer factor to downscale frames by (e.g. 2, 3,
                         4...), where the frame is scaled to width/N x
                         height/N (thus -d 1 implies no downscaling). Each
                         increment speeds up processing by a factor of 4 (e.g.
                         -d 2 is 4 times quicker than -d 1). Higher values can
                         be used for high definition content with minimal
                         effect on accuracy. [default: 2 for SD, 4 for 720p, 6
                         for 1080p, 12 for 4k]
  -fs, --frame-skip N    Skips N frames during processing (-fs 1 skips every
                         other frame, processing 50% of the video, -fs 2
                         processes 33% of the frames, -fs 3 processes 25%,
                         etc...). Reduces processing speed at expense of
                         accuracy.  [default: 0]
  -s, --stats CSV        Path to stats file (.csv) for writing frame metrics
                         to. If the file exists, any metrics will be
                         processed, otherwise a new file will be created. Can
                         be used to determine optimal values for various scene
                         detector options, and to cache frame calculations in
                         order to speed up multiple detection runs.
  -v, --verbosity LEVEL  Level of debug/info/error information to show.
                         Setting to none will suppress all output except that
                         generated by actions (e.g. timecode list output). Can
                         be overriden by `-q`/`--quiet`.
  -l, --logfile LOG      Path to log file for writing application logging
                         information, mainly for debugging. Make sure to set
                         `-v debug` as well if you are submitting a bug
                         report.
  -q, --quiet            Suppresses all output of PySceneDetect except for
                         those from the specified commands. Equivalent to
                         setting `--verbosity none`. Overrides the current
                         verbosity level, even if `-v`/`--verbosity` is set.
  -h, --help             Show this message and exit.

Commands:
  about             Print license/copyright info.
  detect-content    Perform content detection algorithm on input video(s).
  detect-threshold  Perform threshold detection algorithm on input video(s).
  help              Print help for command (help [command]).
  list-scenes       Prints scene list and outputs to a CSV file.
  save-images       Create images for each detected scene.
  split-video       Split input video(s) using ffmpeg or mkvmerge.
  time              Set start/end/duration of input video(s).
  version           Print version of PySceneDetect.

Analyzing video at /some/path/video.mp4 and saving each scene to a separate file:

# docker run -v /some/path:/video:z pyscenedetect:latest -i /video/video.mp4 -o /video/ detect-content split-video

More information

OS and python-version used by this image:

$ podman run -it --entrypoint /bin/bash handflucht/pyscenedetect 
# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
# python --version
Python 3.9.0