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
)

Source plugin priority: bestsource → ffms2 → lsmas

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

Extracting Unfiltered Raw H.264 Video

You can also use this library to get a VapourSynth VideoNode of an H.264 stream with the in-loop deblocking filter disabled, essentially showing the raw block artifacts before any post-processing is applied by the codec itself. This relies on PyAV.

from qpmbdeblock.h264_indexer import h264_no_inloop_filter

# Returns a pure VS clip without the deblock filter.
# Since libavcodec is used frame extraction can be random-access frame accurate.
# During the first run, a '.idx' file will be built to ensure accurate seeking.
clip_nodeblock = h264_no_inloop_filter("video.mkv")

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 .

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

qpmbdeblock-0.4.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.4.0-cp312-cp312-win_amd64.whl (87.8 kB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

qpmbdeblock-0.4.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.4.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for qpmbdeblock-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2bb3274ef0a171d4bc409bf9aaafab8284a3142cfeb8d15c0688023693c367f5
MD5 2a131c8cf13180893395fdef437c1e01
BLAKE2b-256 ccb6479b1e25c11ed52d0d3875a27c4bbafd528eae3d6e67876043176b45f6f0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for qpmbdeblock-0.4.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2f634c40b1bc6db0db0f0a4b703046258de17934ddc80af009e804e6bfde81e6
MD5 1f33245060b30649f6e9d0d166c30b52
BLAKE2b-256 1986cfe95b2a94ecf56be18f00fe4b9d8f9639a79dc0d7ea1f3c70c79afdef1a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for qpmbdeblock-0.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 480531b7a6acfef7ba78da13adcdf6d2d8e33725ce04e9ee14119416aec7c6eb
MD5 514e2c0b8914fb031c50f5c828b7f2c6
BLAKE2b-256 d3ca822db597ef99566d8ed1be630e5301b7bebfbffb932b5143cf76237ff038

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for qpmbdeblock-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 abd067a2f810290128b0c4e753a4cf2f9fd13e092df6d71c88e539507158ffc2
MD5 15799b6d6429dedfe0ccf36198c40d46
BLAKE2b-256 a977c39099e88b413984fba67305b404c620e46f2e1a4d25c65f5d647cd62f26

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for qpmbdeblock-0.4.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0422707cda0fa5032cf641135762ff1573a74bc5198c3e56ca8d2449e426cf85
MD5 7d95e33e0e13e19a8487869d4c136baa
BLAKE2b-256 1efe7a864568106c6c1810c3fa2f090343b6aec07c7769a2f9d796d443e87dee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for qpmbdeblock-0.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9d8a8f07125e56d9bdd8db16b51d1fa7c3996bff9bbf2e7197e972780f44fc88
MD5 65f2ae2e3c38abc7c59e61d54d8e53b5
BLAKE2b-256 f6e6017d125fdc0268166b8943cf72f684f9aa5225ce2fb8ec4490109ea0d4a2

See more details on using hashes here.

Provenance

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