pymp4 is a Python library designed for parsing MP4 boxes, providing a structured way to read and interpret the internal components of an MP4 file. It focuses on low-level access to box data. The current version is 1.4.0, and releases occur periodically, often in response to bug fixes or new box definitions.
pip install pymp4Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `pymp4` to parse top-level boxes from an MP4 file. It creates a simple dummy MP4 file for demonstration, then uses `BoxParser` to iterate through and print information about the parsed boxes. In a real application, you would replace the dummy file creation with opening an existing MP4 file.
If your code interacts with or inspects `TrackEncryptionBox` fields, review the updated definitions. Ensure that `version` is 0 or 1, `is_encrypted` is 0 or 1, and `iv_size` is 0 or 8. Relying on previous, potentially incorrect, field values may lead to parsing errors or unexpected behavior.
Understand the library's scope. If you need to manipulate or generate MP4 files, you will need to combine `pymp4` with other libraries or tools (e.g., `mp4box.js` via external processes, `ffmpeg`).
Ensure input MP4 files are well-formed. Implement robust `try-except` blocks around parsing logic when dealing with files from untrusted sources or those that might be incomplete/corrupted, to handle potential `struct.error`, `IndexError`, or `EOFError`.
No dependency data recorded yet.