Skip to main content

QPMBDeblock

Modern, high-performance in-memory H.264 QP map extractor and raw stream decoder for VapourSynth and Python, backed by native C++ FFmpeg (libavcodec/libavformat).

Features

  • 100% In-Memory Architecture: No temporary disk MKV files, no slow IPC pipes, zero disk wear.
  • Fast C++ LRU Cache: 64-frame in-memory circular cache with sub-millisecond seeking and sub-400MB memory footprint.
  • Synchronized Three-Stream Pipeline: Single entrypoint open_h264_source() yielding:
    1. clip_src: Reference clip loaded via vapoursynth-bestsource.
    2. qpmap: Macroblock QP map (GRAY8 / GRAY16, or full YUV with ITU-T Table 8-15 chroma derivation).
    3. clip_nodeblock: Video decoded with in-loop deblocking filter disabled (skip_loop_filter = AVDISCARD_ALL).
  • Full Bit-Depth & Chroma Subsampling Support: Seamlessly decodes 8-bit and 10-bit H.264 streams across 4:2:0, 4:2:2, and 4:4:4 profiles (High, High 10, High 4:2:2, High 4:4:4 Predictive).
  • Automated PPS Chroma Offset Detection: Automatically parses and extracts chroma_qp_index_offset / second_chroma_qp_index_offset from the stream's Picture Parameter Set (PPS).
  • Corrupted Block Tracking: Automatically detects and clamps corrupted blocks (QP == -1) to 0, reporting exact macroblock coordinates via console logs and frame properties (QPCorrupted, QPCorruptedCoords).

Installation

pip install QPMBDeblock

Pre-built binary wheels are distributed for Windows (x86_64) and Linux (x86_64, aarch64) with dynamic FFmpeg shared libraries bundled in compliance with LGPL v2.1.


VapourSynth Quickstart

import vapoursynth as vs
from qpmbdeblock import open_h264_source

core = vs.core

# Open all three 1:1 frame-synchronized VideoNodes in-memory
clip_src, qpmap, clip_nodeblock = open_h264_source(
    "video.mkv",
    scale_video=True,       # Upscale QP map to match clip_src dimensions (Point resize)
    high_bitdepth=True,     # Output QP map in GRAY16 (values 0-63 scaled)
    chroma_qpmap=False,     # True = derive full YUV chroma planes; False = single GRAY plane
    chroma_qp_offset=None,  # None = auto-detect PPS offsets from video; or provide manual int/(cb, cr)
)

# Set outputs for previewing (e.g. vsview)
clip_src.set_output(0)
qpmap.set_output(1)
clip_nodeblock.set_output(2)

Frame Properties

qpmap automatically injects diagnostic and stream metadata into VapourSynth frame properties:

Property Type Description
QPCorrupted int 1 if invalid/corrupted macroblocks (-1) were found and clamped to 0, else 0.
QPCorruptedCount int Total number of corrupted blocks detected in the frame.
QPCorruptedCoords str List of (row, col) coordinates of the corrupted macroblocks.
ChromaQPOffsetCb int PPS chroma_qp_index_offset extracted from the stream (e.g. -3).
ChromaQPOffsetCr int PPS second_chroma_qp_index_offset extracted from the stream.

Deblocking Filter Usage

import vapoursynth as vs
from qpmbdeblock import open_h264_source, av2deblock

core = vs.core

clip_src, qpmap, clip_nodeblock = open_h264_source("input.mkv", high_bitdepth=False)

# Apply AV2 deblocking guided by QP map
deblocked_8x8, deblocked_4x4, debug_clip = av2deblock(
    clip=clip_nodeblock,
    qpmap=qpmap,
    mbmap=..., # macroblock mode map
    qpmap_offset=0,
)

Building from Source

Requirements:

  • Python ≥ 3.12
  • CMake ≥ 3.15
  • C++17 compatible compiler (MSVC 2019+, GCC 9+, Clang 10+)
  • FFmpeg shared development libraries (libavcodec, libavformat, libavutil)
# Windows (specify FFmpeg directory if not in PATH):
$env:FFMPEG_ROOT = "C:\path\to\ffmpeg-full_build-shared"
pip install .

# Linux (Debian / Ubuntu):
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev
pip install .

License

This project is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0). FFmpeg dependencies are dynamically linked under the terms of the GNU LGPL v2.1.

Metadata

Release files for QPMBDeblock 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for QPMBDeblock 0.5.0
File
qpmbdeblock-0.5.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
qpmbdeblock-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
qpmbdeblock-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details
qpmbdeblock-0.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
qpmbdeblock-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
qpmbdeblock-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details

Total release size: 101.8 MB

Release files / qpmbdeblock-0.5.0-cp313-cp313-win_amd64.whl

Download URL qpmbdeblock-0.5.0-cp313-cp313-win_amd64.whl
Size 48.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
994d7e401508131c586196dbf2b42c6b1137d043eee66e76d71915f4ca0fe0f4
BLAKE2b-256 checksum
How to use checksums
9a7c02bbe81ac2f8f1e5f47203fa3b9de09e2ef7f52e4f8c7f3d35b603285bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / qpmbdeblock-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL qpmbdeblock-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 1.5 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8ccbb321ec32e1ccb0d9560b9b85cb93be18b254d1c457d62325ef73632a10da
BLAKE2b-256 checksum
How to use checksums
8634a57445c81ebc3be4059a3493a56931e1b4d04b5a09df2762cf702c67cfc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / qpmbdeblock-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL qpmbdeblock-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl
Size 1.5 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4801e8995c2c560690272d5fb2aa7f2a90ba461171b66f575699a4c87f89fb7c
BLAKE2b-256 checksum
How to use checksums
c5e08fa71e66afb267d0602e772d369a5bcc045b17263088f49659b662e8e2f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / qpmbdeblock-0.5.0-cp312-cp312-win_amd64.whl

Download URL qpmbdeblock-0.5.0-cp312-cp312-win_amd64.whl
Size 48.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
ee70a0f16d0965f71c961dbfb259fc5d408a7ccfbec2e7151daf45288efe4a83
BLAKE2b-256 checksum
How to use checksums
178f75e19bcdf45965d324a3121ebc21eb19876928713f631c9626ee4b4c9350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / qpmbdeblock-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL qpmbdeblock-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 1.5 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
49bf01d7b1901a43fa85c3b45827321232a657797e5f273ffd39a575c02951d9
BLAKE2b-256 checksum
How to use checksums
abd7941c8d468a27e6a7d536f4dad00009e893b615dabfd0ee6c93e6bb38b793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / qpmbdeblock-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL qpmbdeblock-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl
Size 1.5 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5faf04272f3641e137253c2f76c1436efe1fd6fa31741f657edc8006d1c1f53e
BLAKE2b-256 checksum
How to use checksums
1cbb89ca1e4fc8587f62fa791b01c4ecef5212d03fafd8ac4649e4f75acc0758
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

6 release files

0.4.2

2 release files

0.4.0

6 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page