AutoQPF
A Python library for generating QPF (QP file) frame time codes for use with x264/x265 encoders, with automatic chapter detection and generation.
Installation
pip install AutoQPF
Uninstall
pip uninstall AutoQPF
Quick Start
Basic Usage
from auto_qpf.qpf import QpfGenerator
# Generate QPF from a media file (supports virtually any media file)
qpf = QpfGenerator().generate_qpf(file_input="path/to/file.mkv")
# Generate QPF from a chapter file (OGM format)
qpf = QpfGenerator().generate_qpf(file_input="path/to/chapters.txt")
Error Handling
from auto_qpf.qpf import (
QpfGenerator,
ChapterIndexError,
ImproperChapterError,
NoChapterDataError
)
try:
qpf = QpfGenerator().generate_qpf(file_input="path/to/file.mkv")
except ChapterIndexError:
print("Issue getting the correct index from the chapters")
except ImproperChapterError:
print("Input has improper or corrupted chapters")
except NoChapterDataError:
print("Input has no chapter data")
API Reference
QpfGenerator.generate_qpf()
Generate QPF frame time codes from media files or chapter files.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
file_input |
str |
Required | Path to the input file (media or OGM chapter file) |
file_output |
str |
None |
Output path for the QPF file. If not specified, automatically generated based on input |
write_to_disk |
bool |
True |
If False, returns a list of converted chapter time codes instead of writing to disk (ignores file_output) |
fps |
float |
23.976 |
Frame rate to use. Required when using .txt (OGM) format. Auto-detected for media files with video tracks |
auto_detect_fps |
bool |
True |
Override user-provided FPS with auto-detected value from media file |
generate_chapters |
bool |
True |
Automatically generate OGM chapter file alongside QPF, correcting improper chapter numbering and extracting named chapters |
ChapterGenerator.generate_ogm_chapters()
Generate or extract OGM-formatted chapter files from media.
Note: Currently requires a
MediaInfo.parse()object. Future versions may support direct file input.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
media_info_obj |
MediaInfo |
Required | Parsed pymediainfo MediaInfo object |
output_path |
Path |
Required | Output path for the OGM chapters file (must have .txt suffix) |
chapter_chunks |
float |
5.0 |
Percentage of file duration per auto-generated chapter (e.g., 5.0 = chapter every 5% of runtime) |
extract_tagged |
bool |
True |
Extract detected tagged chapters from source |
extract_named |
bool |
True |
Extract detected named chapters from source |
extract_numbered |
bool |
True |
Extract detected numbered chapters from source (validates correct format) |
write_to_file |
bool |
True |
If False, returns chapter content as string instead of writing to disk |
Behavior: If any extract_* parameter is set to False and that chapter type is detected, the program will automatically generate clean numbered chapters instead.
Example
from auto_qpf.generate_chapters import ChapterGenerator
from pymediainfo import MediaInfo
media_info = MediaInfo.parse("path/to/file.mkv")
# Write chapter file to disk
chapter_path = ChapterGenerator().generate_ogm_chapters(
media_info_obj=media_info,
output_path="chapters.txt"
)
print(f"Chapters written to: {chapter_path}")
# Get chapter content as string without writing
chapter_content = ChapterGenerator().generate_ogm_chapters(
media_info_obj=media_info,
output_path="", # Not used when write_to_file=False
write_to_file=False
)
print(chapter_content)
License
See LICENSE file for details.
Release files for autoqpf 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autoqpf-0.2.5.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autoqpf-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / autoqpf-0.2.5.tar.gz
| Download URL | autoqpf-0.2.5.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcfd91bd12610451d934fa5587438c53b4b8620dfb44c34fd6acb65eba9636d5
|
|
BLAKE2b-256 checksum How to use checksums |
3256302de5dc57ae4e8a0d645b863c50a6fcaf2912e412b1e8fa9d232c3f0d01
|
| 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":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / autoqpf-0.2.5-py3-none-any.whl
| Download URL | autoqpf-0.2.5-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0798b94bb5adcea0de5834b67b3617ef1c52ceb5049ad1b3f721241e5dc34fc8
|
|
BLAKE2b-256 checksum How to use checksums |
f547f9e785672924896cc27a3bb8a37d737016a0847d0365f6f0785b19bd0e80
|
| 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":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|