Skip to main content

qtfaststart2

Tests PyPI

Make QuickTime and MP4 files start playing before they finish downloading, by moving the metadata (the moov atom) to the front of the file.

qtfaststart2 is a maintained fork of qtfaststart, which hasn't been updated since 2016. It's based on qt-faststart.c from FFmpeg and on ISO 14496-12 (the MP4 spec). It's pure Python, so there's nothing to compile.

Features

  • Pure Python, works anywhere Python 3.7+ runs
  • Handles 32-bit (stco) and 64-bit (co64) chunk offsets
  • Handles files with several mdat atoms, and an mdat that runs to the end of the file
  • Keeps the order of all other atoms, and drops free (padding) atoms
  • Can replace the original file safely when no output file is given
  • Leaves files that are already set up for streaming alone

Install

pip install qtfaststart2

Usage

qtfaststart2 input.mp4 output.mp4

If you leave out the output file, the input is replaced. The new file is written next to the original first and only moved into place when it's complete, and a file that's already optimised isn't touched.

qtfaststart2 video.mp4

Options:

Option What it does
-l, --list List the top-level atoms and their sizes, in file order
-s, --sample Write a small sample (the headers plus 4 MiB of each atom), handy for bug reports. Needs an output file
-e, --to_end Move the moov atom to the end instead (for testing)
-d, --debug Show debug output

The exit code is 0 when the file was converted or was already optimised, and 1 when it couldn't be processed.

python -m qtfaststart2 ... works too.

Python API

from qtfaststart2 import processor
from qtfaststart2.exceptions import FastStartException

try:
    written = processor.process("input.mp4", "output.mp4")
except FastStartException as e:
    print("Couldn't process the file:", e)
else:
    if not written:
        print("Already optimised, nothing written")

process() returns True when it wrote the output file and False when the input was already optimised (nothing is written then). Errors are subclasses of FastStartException: FastStartSetupError (for example when input and output are the same file), MalformedFileError and UnsupportedFormatError (compressed moov atoms, or offsets that would pass 4 GiB in an stco atom).

processor.get_index(open("input.mp4", "rb")) returns the list of top-level atoms as (name, position, size) tuples.

Development

git clone https://github.com/danielyaa5/qtfaststart2
cd qtfaststart2
python -m unittest discover tests   # the ffmpeg test is skipped without ffmpeg
bin/qtfaststart2 --list some.mp4    # run without installing

To release, bump VERSION in qtfaststart2/__init__.py, add the version to CHANGES.md, and publish a GitHub release tagged with the version number. The publish workflow uploads it to PyPI.

License

MIT, see LICENSE.md.

Metadata

Release files for qtfaststart2 2.2.0

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

Source distribution (sdist)

Source distribution for qtfaststart2 2.2.0
File Size Uploaded Provenance Actions
qtfaststart2-2.2.0.tar.gz 15.3 kB With provenance Details for qtfaststart2-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qtfaststart2 2.2.0
File Interpreter ABI Platform Actions
qtfaststart2-2.2.0-py3-none-any.whl Python 3 none any Details for qtfaststart2-2.2.0-py3-none-any.whl

Total release size: 26.1 kB

Release files / qtfaststart2-2.2.0.tar.gz

Download URL qtfaststart2-2.2.0.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a1009b32f3453163d96456e322b8172a8b9ecce8f7c472987bb442731332053e
BLAKE2b-256 checksum
How to use checksums
9c8adbd1f992ed32e92abeeded22b67d37b90bbe15f9239d2eefa5afb63c75e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / qtfaststart2-2.2.0-py3-none-any.whl

Download URL qtfaststart2-2.2.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8b02b54dd6980c4159d874736b3a34103559f48a637f6665f3e48928564ca16
BLAKE2b-256 checksum
How to use checksums
2d287f1f2945209d62ac43dcfb95d85e5c19db5dccbc5de86c6c2fdeff6f4087
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for qtfaststart2 2.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qtfaststart2-2.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

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.

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