Skip to content

Command Line Tools

Jerry Hogsett edited this page Feb 21, 2023 · 2 revisions

interpolate.py

Creates an interpolated frame between two frames

Example: Recover a lost frame between two frames

python interpolate.py

  • loads images/image0.png and images/image2.png
  • interpolates and saves images/image1.png

Use python interpoloate.py --help for arguments

deep_interpolate.py

Creates a chosen number of interplolated frames between two frames

Example: Create 4X slow motion between two frames

python deep_interpolate.py --depth 2

  • loads images/image0.png and images/image2.png
  • interpolates three evenly-speced between frames
  • the original and new frames are put in output/interpolated_frame0.png ... interpolated_frame4.png
  • the depth argument specifies the number of doublings of the effective frame rate
    • the number of newly created frames = 2 ** depth - 1

Use python deep_interpoloate.py --help for arguments

interpolate_series.py

Split a sequence of video frame PNGs to any depth to create super-slow-motion

Example: Inflate a video sequence 4X

python interpolate_series.py

  • loads images/image0.png thru images/image2.png
  • interpolates three evenly-spaced frames between each frame
  • the original three frames and six interpolated frames are put in output
    • the files are named for their original frame number and interpolation sequence
    • the file resequencing tool (below) can be used to create a set of sequentially numbered files for import into video editing software

Use python interpoloate_series.py --help for arguments

interpolate_target.py

Search for a frame at a precise time between two frames and return the closest match

Example #1: Quickly find a frame about 1/3 of the way between two frames:

python interpolate_target.py

  • loads images/image0.png and images/image2.png
  • searches for the frame closest to 1/3
  • uses a high split count of 10 for precision
  • creates output/interpolated_frame@0.3330078125.png

Example #2: Precisely find a frame exactly 2/3 of the way between two frames:

python interpolation_target.py --min_target 0.666666666 --max_target 0.666666668 --depth 30

  • loads images/image0.png and images/image2.png
  • searches for a high precision match to a frame closest to exactly 2/3
  • uses a super high split count of 30 for precision
  • creates output/interpolated_frame@0.6666666669771075.png
  • on my PC, I get a result in 17 seconds (1.68s/it)
    • running a regular deep interpolate to gain this precision at 30 splits would take > 57 years!

Use python interpoloation_target.py --help for arguments

resequence_files.py

Rename a series of PNG files with sequential integers for easy import into video editing software

Example: Change the output from the deep interpolate example for import into Premiere Pro

python resequence_files --path ./output

  • loads all PNG files found in ./output
  • duplicates each with new sequential filenames pngsequence0.png thru pngsequence8.png

Use python resequence_files.py --help for arguments

  • Use --rename to rename the files in place instead of making duplicates

restore_frames.py

Recreate multiple adjacent replacement frames

Example: Restore two adjacent missing frames

python restore_frames.py

Use python restore_frames.py --help for arguments

resample_series.py

User interpolation and sampling to convert frame rates

Example: Change a movie 30 to 120 FPS

python resample_series.py --original_fps 30 --resampled_fps 120

  • loads images/image0.png through images/image2.png
  • creates an inflated super-set of frames at the new frame rate
  • outputs new frames at ./output

Use python resample_series.py --help for arguments