video-clip-sh/README.md
2025-02-16 23:32:59 -08:00

2.1 KiB

video-clip-sh

Collection of scripts to help with clipping videos, especially finding the exact start/end frames for a clip.

find_split

This is the main script. It repeatedly plays a short segment of a video whose position can be adjusted to help find the start/end frame for a clip.

USAGE: find_split [video] [position_in_frames] [span_in_frames] [left|right]
  • video: The path to the video file to clip.
  • position_in_frames: The initial position to focus on (in frames).
  • span_in_frames: How long a segment to play at a time (in frames). Generally 30-300 frames (1-10 seconds) is the useful range.
  • left|right: left means to play the span before the position, so the segment played is either the end of the clip or the section of the video immediately before the clip. right is the opposite: the position is the first frame of the clip, so the displayed video can be thought of as the start of a clip or the section of the video immediately after the clip.

find_split is interactive: after each segment is played it waits for keyboard input to select the next segment to play. The keyboard commands are:

  • ` (backtick): exit and output the command to resume the current state.
  • \: swap left/right. i.e., change whether the clip played is starting or ending at the current position.
  • =: toggle video output (audio is always enabled)
  • a/s/d/q/w/e: shift position earlier (uppercase moves further)
  • f/g/h/r/t/y: shift position later (uppercase moves further)
  • z/x/c: reduce length of preview clips (uppercase changes it more)
  • v/b/n: increase length of preview clips (uppercase changes it more)

encode_frames

Once you've used find_split to find both the start and end frame positions, use this script to actually clip the video.

USAGE: encode_frames [in_video] [start] [end] [out_video] [av|audio]

start and end are frame positions. in_video and out_video are the input and output filenames. The final argument is av to include the video or audio to only output audio.