Skip to main content

video2pdfslides-tddschn

Based on https://github.com/kaushikj/video2pdfslides,

credits to https://github.com/kaushikj.

Description

This project converts a video presentation into a deck of pdf slides by capturing screenshots of unique frames
youtube demo: https://www.youtube.com/watch?v=Q0BIPYLoSBs

Additional features

  • Add support for specifying parameters via command line options.
  • Add --no-verify to skip manual inspection and deduplication of extracted images and save to pdf directly.
  • Add -c / --clip to copy the output pdf path to clipboard.
  • Installable via pipx install video2pdfslides-tddschn.

Table of Contents

Installation

Requires Python 3.9.

pipx

This is the recommended installation method.

$ pipx install video2pdfslides-tddschn --python "$(which python3.9)"

pip

$ python3.9 -m pip install video2pdfslides-tddschn

Usage

video2pdfslides <video_path> <options>

# or, use the shorthand v2ps:
v2ps <video_path> <options>

it will capture screenshots of unique frames and save it output folder...once screenshots are captured the program is paused and the user is asked to manually verify the screenshots and delete any duplicate images. Once this is done the program continues and creates a pdf out of the screenshots.

$ v2ps --help

usage: video2pdfslides [-h] [-o OUTPUT_SLIDES_DIR] [-r FRAME_RATE] [-w WARMUP] [-f FGBG_HISTORY] [-v VAR_THRESHOLD] [-s] [-m MIN_PERCENT] [-x MAX_PERCENT]
                       [-n] [-c] [-V]
                       INPUT_VIDEO_PATH

Converts a video presentation into a deck of pdf slides by capturing screenshots of unique frames

positional arguments:
  INPUT_VIDEO_PATH      path of video to be converted to pdf slides

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT_SLIDES_DIR, --output-slides-dir OUTPUT_SLIDES_DIR
                        path of output folder (default: output)
  -r FRAME_RATE, --frame-rate FRAME_RATE
                        no of frames per second that needs to be processed, fewer the count faster the speed (default: 1)
  -w WARMUP, --warmup WARMUP
                        initial number of frames to be skipped (default: 1)
  -f FGBG_HISTORY, --fgbg-history FGBG_HISTORY
                        no.of frames in background object (default: 15)
  -v VAR_THRESHOLD, --var-threshold VAR_THRESHOLD
                        Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the
                        background model. This parameter does not affect the background update. (default: 16)
  -s, --detect-shadows  If true, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the
                        parameter to false. (default: False)
  -m MIN_PERCENT, --min-percent MIN_PERCENT
                        min percentage of diff between foreground and background to detect if motion has stopped (default: 0.1)
  -x MAX_PERCENT, --max-percent MAX_PERCENT
                        max percentage of diff between foreground and background to detect if frame is still in motion (default: 3.0)
  -n, --no-verify       skip manual inspection and deduplication of extracted images and save to pdf directly. (default: False)
  -c, --clip            copy the path of the output pdf to clipboard. (default: False)
  -V, --version         show program's version number and exit

Example

There are two sample video avilable in "./input", you can test the code using these input by running

  • python video2pdfslides.py "./input/Test Video 1.mp4" (4 unique slide)
  • python video2pdfslides.py "./input/Test Video 2.mp4" (19 unique slide)

    More

    The default parameters works for a typical video presentation. But if the video presentation has lots of animations, the default parametrs won't give a good results, you may notice duplicate/missing slides. Don't worry, you can make it work for any video presentation, even the ones with animations, you just need to fine tune and figure out the right set of parametrs, The 3 most important parameters that I would recommend to get play around is "MIN_PERCENT", "MAX_PERCENT", "FGBG_HISTORY". The description of these variables can be found in code comments.

    Develop

    $ git clone https://github.com/tddschn/video2pdfslides-tddschn.git
    $ cd video2pdfslides-tddschn
    $ poetry install
    

    Developer contact info

    kaushik jeyaraman: kaushikjjj@gmail.com

  • Metadata

    Release files for video2pdfslides-tddschn 0.2.2

    For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

    Source distribution (sdist)

    Source distribution for video2pdfslides-tddschn 0.2.2
    File Size Uploaded
    video2pdfslides-tddschn-0.2.2.tar.gz 7.8 kB Details

    Built distribution (wheel)

    Table of built distributions (wheels) for video2pdfslides-tddschn 0.2.2
    File Interpreter ABI Platform
    video2pdfslides_tddschn-0.2.2-py3-none-any.whl Python 3 none any Details

    Total release size: 16.6 kB

    Release files / video2pdfslides-tddschn-0.2.2.tar.gz

    Download URL video2pdfslides-tddschn-0.2.2.tar.gz
    Size 7.8 kB
    Tags Source
    SHA-256 checksum
    How to use checksums
    3c4f069b75327b53840b4d27015b5749df7e19bc1d0d87ac1a0f7c7c7e947d6e
    BLAKE2b-256 checksum
    How to use checksums
    5b0491724d869c8250e470f3ef41f1333c86196fee9433326073a26570876003
    Upload date
    Uploaded using Trusted Publishing?
    What is trusted publishing?
    No
    Uploaded via poetry/1.2.1 CPython/3.10.5 Darwin/22.1.0

    Release files / video2pdfslides_tddschn-0.2.2-py3-none-any.whl

    Download URL video2pdfslides_tddschn-0.2.2-py3-none-any.whl
    Size 8.8 kB
    Tags Python 3
    SHA-256 checksum
    How to use checksums
    25f6b20ce0d4228d4ac16dcb2bcfaf1383cd28aed3e26c61204f22cdce85ea7e
    BLAKE2b-256 checksum
    How to use checksums
    3503a6adc2fddbee842b07002b6fc1d6b83bda05d05daf0736ecfaf16f33701a
    Upload date
    Uploaded using Trusted Publishing?
    What is trusted publishing?
    No
    Uploaded via poetry/1.2.1 CPython/3.10.5 Darwin/22.1.0

    Release history Release notifications | RSS feed

    This release

    0.2.2 This release

    2 release files

    0.2.1

    2 release files

    0.2.0

    2 release files

    0.1.7

    2 release files

    0.1.6

    2 release files

    0.1.5

    2 release files

    0.1.4

    2 release files

    0.1.3

    2 release files

    0.1.2

    2 release files

    0.1.1

    2 release files

    Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page