Skip to main content

Cut and join CLI wrapper for ffmpeg.

  • Free software: BSD 2-Clause License

Installation

pip install ffmpeg-cut

You can also install the in-development version with:

pip install https://github.com/ionelmc/python-ffmpeg-cut/archive/main.zip

Documentation

https://python-ffmpeg-cut.readthedocs.io/

Usage: ffmpeg-cut [-h] [[-j | -c W:H | -f W:H |] -n] [-q CRF] [-d] [-r] [-s FPS] [-e ENCODER] [-t] [-l] input output [cut] [cut ...]

positional arguments:
input

input file

output

output file

cut

pair of timestamps to cut

options:
-h, --help

show this help message and exit

-j, --join

input file is ffmpeg concat instruction file

-c SIZE, --crop SIZE

crop input to a given ratio

-f SIZE, --filter SIZE

arbitrary filter on specific zone

-n, --no-join

only produce the intermediary clips and ffmpeg concat instruction file

-q CRF, --quality CRF

libx265 crf

-d, --dry-run

only display what would be run

-r, --dirty

do not delete intermediary files

-s FPS, --fps FPS

output framerate

-e ENCODER, --encoder ENCODER

you can use libx265 for better compression but possibly worse player support

-t, --text

input file is text file with cuts

-l, --clips

input file is clips file with cuts

If you use –text then the input file must contain instructions in the form:

path/to/video.mkv
HH:MM:SS.mmm-HH:MM:SS.mmm
HH:MM:SS.mmm-HH:MM:SS.mmm

path/to/another/video.mp4
HH:MM:SS.mmm-HH:MM:SS.mmm
HH:MM:SS.mmm-HH:MM:SS.mmm
HH:MM:SS.mmm-HH:MM:SS.mmm

Development

To run all the tests run:

tox

Note, to combine the coverage data from all the tox environments run:

Windows

set PYTEST_ADDOPTS=--cov-append
tox

Other

PYTEST_ADDOPTS=--cov-append tox

Changelog

1.0.2 (2025-01-13)

  • Switch to Matroska clips for the intermediate files to avoid “Non-monotonic DTS” warnings.

  • Added some timestamp fixup (avoid_negative_ts) in the cut phase to avoid some warnings (and maybe wrong output).

1.0.1 (2025-01-13)

  • Added –version option.

  • Fixed broken run function.

1.0.0 (2024-09-26)

  • First release on PyPI.

Release files for ffmpeg-cut 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ffmpeg-cut 1.0.2
File Size Uploaded
ffmpeg_cut-1.0.2.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ffmpeg-cut 1.0.2
File Interpreter ABI Platform
ffmpeg_cut-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / ffmpeg_cut-1.0.2.tar.gz

Download URL ffmpeg_cut-1.0.2.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3ff5af6dc74cea72b0c988398a530217256ed7fddd383eee749c6931bba94c43
BLAKE2b-256 checksum
How to use checksums
9a88ad87d339f83685c763bfaa31101c92b61b35f2beb482c3334077cea5bcf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.8

Release files / ffmpeg_cut-1.0.2-py3-none-any.whl

Download URL ffmpeg_cut-1.0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e5f47570401d291d637a963e50a539d3149ed392cd3c321ee272f90519c9414
BLAKE2b-256 checksum
How to use checksums
022165511c7301d3ae140a4d953ea577f07046abd6863bedfe3a915bae7ae74f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page