Video Splitter

This python script will convert a MP4 into multiple smaller video files. Paremeters allow you to choose a region of the original video to clip.

This is useful if you want to capture only a portion of a landscape format video and save it in an upright (portrait) format for use as "short-form" video content such as YouTube Shorts, Instagram Reels, TikTok, and more.

Take a full length video such as ..

.. and create random clips of various lengths that look like ..

The user can set the following parameters

  • Max and Min length (in seconds) of clipped video
  • Number of clipped videos to generate
  • Image to burn in as overlay
  • Prefix of clipped video file name
  • clipped video dimension and rotation
  • Dimensions of region to crop
  • Region of original video to crop

The user can set the input file

input_file = "video/Ep77.mp4"

Length of clipped videos

min_duration = 37
max_duration = 59

Number of clipped videos

num_clips = 30

Image to burn in as overlay

burn_in_image_path = "images/77-header.png"

Length of clipped videos

file_prefix = "Ep77-mov_"

Clipped video dimension and rotation

    dimensions = (1080, 1920) # width, height
    rotation = 0

Dimensions of region to crop

    crop_width = 350
    crop_height = 500

Region of original video to crop

    crop_x1 = 325
    crop_y1 = 100
    crop_x2 = crop_x1 + crop_width
    crop_y2 = crop_y1 + crop_height

NOTE: You will need ffmpeg installed locally