mp4_splitter
Command-line utility for splitting MP4 files into multiple clips based on a CSV segment list.
Requirements
- Python 3.10.12 or newer
ffmpegavailable on yourPATH
Installation
pip install mp4sp
# or, inside this repository
uv sync
uv run mp4sp --help
Preparing the segment list
Create a UTF-8 CSV file with the columns filename, start, and end. Timestamps can be in HH:MM:SS[.mmm] format.
filename,start,end
test.mp4,00:00:01.000,00:00:05.167
test.mp4,00:00:05.168,00:00:10.000
test.mp4,00:00:10.001,00:01:03.000
another.mp4,12,24
filenameis resolved relative to the input directory you pass via--input.- Each row produces an output file named
<original>_cut_<index>.mp4. - Pure numbers in
start/endare treated as seconds, soanother.mp4,12,24means “take another.mp4 from 12s to 24s,” yielding a 12-second clip. - If you pass a single file to
--input, ensure thefilenamecolumn matches that file name; all other rows are skipped automatically.
Usage
- Place the source videos under an input folder (or point directly at a single
.mp4file), e.g.videos/. - Create the CSV file as described above, e.g.
split_list.csv. - Run the CLI:
mp4sp \
--input videos \
--output clips \
--csv split_list.csv \
--threads 8 \
--safe
Options
--input / -i: Directory containing the source MP4 files (required). You may also pass a single.mp4file path, in which case rows for other files are ignored and only that file is processed.--output / -o: Directory in which the clips will be written (required; created if missing).--csv / -c: Path to the CSV file with segment definitions (required).--threads / -t: Number of parallel splits to run. Defaults to 4.--safe / -s: Re-encode each clip to avoid artifacts (slower but frame-accurate).
Set --safe when you need artifact-free cuts or when cutting from formats where keyframes are sparse. Omit it for the fastest stream-copy mode.
Example from source checkout
uv run mp4sp \
-i samples/input \
-o samples/output \
-c split_list.csv \
-t 4 \
-s
Upon completion the tool logs progress for each clip and finishes with All tasks completed.. The resulting files reside in the output directory.
Metadata
Release files for mp4sp 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mp4sp-1.0.3.tar.gz | 7.1 kB | Without provenance | Details for mp4sp-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mp4sp-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for mp4sp-1.0.3-py3-none-any.whl |
Total release size: 12.9 kB
Release files / mp4sp-1.0.3.tar.gz
| Download URL | mp4sp-1.0.3.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f9199b9358511732107f78bed3289e6b4ce38a58a5bfa11164c3214c0e3224f
|
|
BLAKE2b-256 checksum How to use checksums |
b7e73f85509fe2a51f210d63fd0cae4e1f797de630dd533b169dc68843bf6e1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mp4sp-1.0.3-py3-none-any.whl
| Download URL | mp4sp-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f6ffd4fd123212f90d311ce7983e30d972f88668539931fc7ff73df9e60a9bd
|
|
BLAKE2b-256 checksum How to use checksums |
3dfa8083a60b5d9addcd23090cb4d66b95d1ffb7107550570d3af4a31d6a7662
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mp4sp 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.