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.3.0-cp313-cp313-win_amd64.whl (84.4 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

qpmbdeblock-0.3.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.3.0-cp312-cp312-win_amd64.whl (84.4 kB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

qpmbdeblock-0.3.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.3.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2b94752abcca3fbc57d1403dbd4ed447da9247667141fca4f4cd2a38fbf36f39
MD5 83b954da052d5ce4bf5015717f8c3ba4
BLAKE2b-256 cc3914589dfdd32f1e18e3ddf2dd025eb5f02325d04a2da16162410c371e3595

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.3.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.3.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.3.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9a21b0c338a0a14ab0110c88e6e14de908f24b8afa05feb165ccf5a6b8f44036
MD5 5e27c65275203c142e51b8d079a149a5
BLAKE2b-256 f018fe8c4e505a194aec59e254bc826f7e88f479c81949fc2d328336077492f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.3.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.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c0851bdff1a4db6e80a3f9aa980c80e365d7588602f2ed4eb78517a1e56fe232
MD5 617dc94b48b266923a3b3d178c4bfc51
BLAKE2b-256 f7b7c5ebbefbe4d98c92c7faffffe6bf472264411cc2607492d290b9822ee9fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.3.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.3.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9209c804a542a2cca69fdb0058cf4a83130f40ffe57ee9d13989a6f28b185218
MD5 8991d75ed580e3c0c90f0e3ce8832494
BLAKE2b-256 9f443af3abfb5d0b7b11f11c3ecf25d36c5c035b0ff7e7a0d5b4481f4b7df9b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.3.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.3.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a6ab8cc338fd68a94a875c97fc5256025932e986f95344558e0d58c9c524be51
MD5 d8a71e82adcfe7cf9a67c2dfe3e40099
BLAKE2b-256 4dd45697c4ac1ea22874150d9d5efd11547c550e7e6b153ea73f80b5f62e27bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.3.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.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b398f06dca985e4f65edecaa7c0839951dbfc82888d4f5446a1ad4fa94b1790a
MD5 4859de1ed483f079165ecb2bf850e2c6
BLAKE2b-256 00f47f667dd6eb272f7e3bc0a1b2c6ae52d302d32c6a39828b6b79cbcb784234

See more details on using hashes here.

Provenance

The following attestation bundles were made for qpmbdeblock-0.3.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