Skip to main content

Fast native H.264 QP and macroblock map extractor using FFmpeg

Project description

QPMBDeblock

Native H.264 QP and macroblock map extractor. Uses FFmpeg's AV_FRAME_DATA_VIDEO_ENC_PARAMS side-data to extract per-macroblock QP values from H.264 streams without log parsing.

Installation

pip install QPMBDeblock

Runtime requirement: FFmpeg must be installed and available in PATH.

Python API

from qpmbdeblock import h264QPparser

parser = h264QPparser("video.mkv")

# Extract + write in one step. Returns output path or None on failure.
result = parser.create_qp_map("output.qpmap.mkv")

# Or separately:
qpmap = parser.extract()           # numpy.ndarray (n_frames, mb_rows, mb_cols), dtype int8
parser.write_video(qpmap, "output.qpmap.mkv")

extract() returns a 3-D int8 NumPy array with QP values in [0, 63].

VapourSynth

from qpmbdeblock import VSqpmap_mask

# Generates output.qpmap.mkv on first call, loads it on subsequent calls.
qp = VSqpmap_mask(
    "video.mkv",
    reference_clip=src,   # required when scale_video=True (default)
    high_bitdepth=True,   # GRAY16, values 0–63
)
Parameter Default Description
qpmap_path <video>.qpmap.mkv Custom path for the QP map MKV
ffmpeg_path "ffmpeg" Path to ffmpeg executable
scale_video True Upscale 16× and crop to reference_clip dimensions
high_bitdepth True Output GRAY16 instead of GRAY8

Source plugin priority: bestsource → ffms2 → lsmas

Build from source

Requirements: CMake ≥ 3.15, C++17 compiler, FFmpeg dev headers, pybind11.

# Set FFmpeg location (Windows only, if not using pkg-config)
$env:FFMPEG_ROOT = "C:\path\to\ffmpeg-full_build-shared"

pip install .

On Linux/macOS with system FFmpeg:

apt install libavcodec-dev libavformat-dev libavutil-dev  # Debian/Ubuntu
pip install .

Output format

Lossless grayscale FFV1 MKV. Each pixel maps 1:1 to one macroblock. Pixel value = QP value (0–63). FPS matches the source video.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qpmbdeblock-0.1.0-cp313-cp313-win_amd64.whl (80.2 kB view details)

Uploaded CPython 3.13Windows x86-64

qpmbdeblock-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

qpmbdeblock-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

qpmbdeblock-0.1.0-cp312-cp312-win_amd64.whl (80.1 kB view details)

Uploaded CPython 3.12Windows x86-64

qpmbdeblock-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

qpmbdeblock-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

Details for the file qpmbdeblock-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2593d6f97c942b77bc8917874f6df14882dbefa2c3fda32f1bd8d4adf48cce99
MD5 ba7af1e4495b46a234fce65924607a96
BLAKE2b-256 586a62c378c59fea536368189ec4bab48622d1cd3f8516b6e4df6b6b9fc8d3a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: build_wheels.yml on PingWer/QPMBDeblock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qpmbdeblock-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c56f15ba14abacfadf4d688e47a7a9eadc61b99600c2c7e1dabdd18a1be4d2ca
MD5 ad2050d03ef43de01ccf2a8636f84081
BLAKE2b-256 0cc2fff5d6dd861e7469d2e732a42dcca6bcc9b10a8245a28a334af14c349956

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: build_wheels.yml on PingWer/QPMBDeblock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qpmbdeblock-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 938ff6c27c285420a997786aa3792452dcde8fbe160199d2babe5479f62a1edf
MD5 51a7b46faf5971338852436ee85fd122
BLAKE2b-256 4adeee6febf5b1283475b606ebf06568a709fd9c1978354cd0c5e5166a7b2782

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_wheels.yml on PingWer/QPMBDeblock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qpmbdeblock-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5f04bca81391da3b6f7c3651ff6a270fd24604300d1d7899301dea18dc6196cf
MD5 f9e3c8a7c743383e76dce97bd3ed8dce
BLAKE2b-256 548566ae3728a9c115e0bd0cc31cb1424c8906962b3e71b20191e9bee7531985

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: build_wheels.yml on PingWer/QPMBDeblock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qpmbdeblock-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8a8f41e1380e8ef473333a93e3dd88359bf3758b6d31a7ea33a27dfd31dae906
MD5 2ec06099cc7b5330eeddae83f5733da3
BLAKE2b-256 33b72d2f6dc6eb493219de83862fdb5068d2bacf9dd1d776ec9c399e94a1ce4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: build_wheels.yml on PingWer/QPMBDeblock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qpmbdeblock-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a0be460fa8454392ab8acc9b9779df5e60efe569d02e821802f8ab0e18dea4fa
MD5 3bf7e431705a10f50ebf2f55f927ed4c
BLAKE2b-256 808694df1d807681c2fb9ea9a4e721bacf5ba3dad170ae0bf0c06ef82d19a332

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build_wheels.yml on PingWer/QPMBDeblock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page