Skip to content

Instantly share code, notes, and snippets.

@OneNiNE87
Created May 27, 2025 16:51
Show Gist options
  • Save OneNiNE87/75b9bdf6c20be493b83d6b9bc4fd99d3 to your computer and use it in GitHub Desktop.
Save OneNiNE87/75b9bdf6c20be493b83d6b9bc4fd99d3 to your computer and use it in GitHub Desktop.
mp4splitting

For splitting large video files by size in Termux without re-encoding, ffmpeg is limited for exact size splits in MP4 format. But here are some alternatives you can try:

  1. mp4box (from GPAC)

mp4box can split MP4 files by time or size with less re-encoding.

Install with:

pkg install gpac

Example to split by size (~1GB):

mp4box -splits 1024 input.mp4

This will split input.mp4 into ~1024 MB parts.

  1. split (standard UNIX tool)

Splits files by bytes but does not preserve MP4 structure.

You get raw file chunks that won't play individually.

Usage:

split -b 1G input.mp4 part_

Use only if you want to split for storage or transfer and rejoin later with cat.

  1. mkvtoolnix (for MKV files)

If you convert MP4 to MKV, mkvmerge can split by size.

Install:

pkg install mkvtoolnix

Example:

mkvmerge -o output.mkv --split size:1024M input.mkv

This requires conversion but MKV supports splitting better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment