How to split large video sizes into smaller videos of equal size?

I want to upload recorded videos to cloud storage and the problem is videos are huge size 10-15 GBs each, is there any way in which I can split the video into smaller video each 1 GB in size?

1 Like

Annie!
Yes, you can divide a large MP4 video into smaller chunks using the MP4Box tool, which is a component of the GPAC (Multimedia Framework) project. A flexible command-line program, MP4Box can segment videos among other things about MP4 files.

Here is the detailed tutorial that you can follow:

1. Install MP4Box

You can easily download the MP4Box from the official GPAC website. Choose the appropriate download version as per your operating system.

GPAC Downloads: Releases · gpac/gpac · GitHub

2. Split Video

Open the command prompt and use the following command to divide your large MP4 video into smaller chunks.

MP4Box -dash seg-duration:duration -frag frag-duration:duration -rap -bs-switching no -profile dashavc264:on -out output_file input_file

Yes, you can use the MP4Box tool, part of the GPAC (Multimedia Framework) project, to split a large MP4 video into smaller segments. MP4Box is a versatile command-line tool that can perform various tasks related to MP4 files, including segmenting videos. Here’s how you can use MP4Box to split a large video into smaller segments:

3. Download and Install MP4Box:

You can download MP4Box from the official GPAC website. Depending on your operating system, you can choose the appropriate download version.

2. Open a Command Prompt or Terminal:

Launch a command prompt or terminal on your computer.

4. Split the Video with MP4Box:

Use the following command to split your large MP4 video into smaller segments:

MP4Box -dash seg-duration:duration -frag frag-duration:duration -rap -bs-switching no -profile dashavc264:on -out output_file input_file
  • seg-duration:duration: Specifies the duration of each segment in seconds.
  • frag-duration:duration: Specifies the duration of each fragment in seconds. Fragments are smaller pieces within each segment.
  • -rap: Generates random access points (sync samples) to ensure that segments can be played independently.
  • -bs-switching no: Disables bitstream switching, which is typically not needed for basic splitting.
  • -profile dashavc264:on: Ensures the H.264 video codec is used (you can adjust this based on your video codec).
  • -out output_file: Specifies the output file pattern for the segmented files. You can use %04d in the output file pattern to create sequentially numbered files.

For example,

We want to split a video named “input.mp4” into 10-second segments and save them as “output001.mp4,” “output002.mp4,” and so on, we can use the following command:

MP4Box -dash 10000 -frag 1000 -rap -bs-switching no -profile dashavc264:on -out output%03d.mp4 input.mp4

Execute the above command.

5. Find the shorter video clips

The smaller video segments can be found in the same directory where you executed the MP4Box command when the process is finished. The pattern you entered in the -out option will be used to name the files.

I tried this command but was confused why video chunks created by mp4box splits option are not exactly similar in size.

Agree with , I think something is missing in the above command may be argument or flag?

Actually, MP4Box tries to split videos with size consideration but I-frames in videos prevent splitting from exactly specified size.

Thanks