Skip to main content

SMPTE RP 219 and ITU-R BT.2111 color bar generator for VapourSynth

Project description

Description

ColorBars is a filter for generating test signals. The output is a single frame of color bars according to SMPTE RP 219-1, 219-2, or ITU-R BT.2111-2. For NTSC, the bar pattern is described in SMPTE EG 1. For PAL, EBU bars are generated.

SMPTE RP 219-2 gives explicit color bar values in 10-bit and 12-bit Y'Cb'Cr'. ITU BT.2111-2 gives explicit color bar values in 10-bit and 12-bit R'G'B'. These values are used directly instead of being generated at runtime.

Usage

colorbars.ColorBars([int resolution=3, int format=vs.YUV444P12, int hdr=0, int wcg=0, int compatability=2, int subblack=1, int superwhite=1, int iq=1, int halfline=0, int filter=1])
  • resolution: Ten different systems are supported as follows

    • 0 - NTSC (BT.601)
    • 1 - PAL (BT.601)
    • 2 - 720p
    • 3 - 1080i/p
    • 4 - 2K
    • 5 - UHDTV1/UHD
    • 6 - 4K
    • 7 - UHDTV2/8K
    • 8 - NTSC (4fsc)
    • 9 - PAL (4fsc)
  • format: Either vs.YUV444P10 or vs.YUV444P12 are supported in SDR mode. Either vs.RGB30 or vs.RGB36 are supported in HDR mode. This is because SMPTE defines bar values in terms of Y'Cb'Cr' and ITU uses R'G'B'.

  • hdr: Non-zero values enable BT.2111 HDR mode as follows

    • 0 - SDR
    • 1 - HLG
    • 2 - PQ
    • 3 - PQ (full range)
  • wcg: Enable ITU-R BT.2020, aka wide color gamut. Only valid with UHD and higher resolutions. Required for 8K, although ColorBars does not enforce this and will generate 8K Rec.709 with a warning. No effect when hdr > 0.

  • compatability: Controls how pedantic you want to be, especially for legacy NTSC/PAL systems. No effect when hdr > 0.

    • 0 - Use ideal bar dimensions, rounded to the nearest integer. Bar widths are specified as fractions of the active picture and can be odd.
    • 1 - Use even bar dimensions to facilitate chroma subsampling. Conversions to YUV420 or YUV422 later may be problematic otherwise.
    • 2 - For NTSC and PAL, ignore blanking. The entire line contains the active image. For HD and higher resolutions, use dimensions that are compatible with chroma subsampling and with 4:3 center-cut downconversion. For UHD/4K and 8K, use multiples of four and eight respectively for 2SI compatibility.

NTSC and PAL both have an active digital width of 720 pixels when using BT.601 (13.5 MHz) sampling. 525-line NTSC has 710.85x484 active picture plus two half lines. 712 is used in modes 0 and 1 with 4 blanking pixels on each side. 625-line PAL has 702x574 active picture plus two half lines. 702 is used in mode 0, with 9 blanking pixels on each side. 704 is used in mode 1, with 8 blanking pixels on each side.

4fsc NTSC (14.318 MHz) has 768 digital active samples. 757.27 samples are active (52+8/9 us). Mode 0 is 758 wide with 5 blanking pixels on each side. Mode 1 is 760 wide with 4 blanking pixels on each side. 4fsc PAL (17.734 MHz) has 948 digital active samples. 922 samples are active (52 us) in modes 0 and 1 with 12 blanking pixels on each side.

NTSC modes 0 and 1 have 486 active lines. DVB/ATSC/DV/HDMI use 480 lines, like in mode 2.

  • subblack: Controls whether to generate the below black ramp in the middle third of the first 0% black patch on the bottom row. Only valid with HD and higher resolutions. No effect when hdr > 0.

  • superwhite: Controls whether to generate an above white ramp in the middle third of the 100% white chip on the bottom row. Only valid with HD and higher resolutions. No effect when hdr > 0.

  • iq: Controls the second patch of rows 2 and 3. Only valid with HD and higher resolutions. No effect when hdr > 0. Mode 1 and 2 are not valid if wcg=1.

    • 0 - 75% white and 0% black
    • 1 - -I and +Q
    • 2 - +I and 0% black
    • 3 - 100% white and 0% black

The +I/-I/+Q values are conveniently specified in RP 219 for systems with Rec.709 primaries (HD up to 4K). For NTSC, the values were calculated and later verified to match an Evertz SDI test signal generator. Note that converting from YUV to RGB will produce out of range values.

  • halfline: For ultimate pedantry, perform halfline blanking on analog lines 284/263 (NTSC) and 23/623 (PAL). Applies to NTSC and PAL resolutions only.

  • filter: Shape the bar transitions instead of leaving instant edges. RP 219 requires proper shaping: rise and fall times of 4 samples (10% to 90%, tolerance +/-10% of nominal) with a shape similar to an integrated sine-squared pulse. HD and higher resolutions are shaped accordingly by convolving each line with a sine-squared pulse. For NTSC and PAL, BT.801-1 applies instead: transitions are shaped by the integral of a Blackman pulse with rise times of 150 ns for Y and 300 ns for Cb/Cr. BT.2111 does not specify shaping, so HDR patterns follow RP 219-2. Flat areas away from transitions keep their exact code values either way.

Examples

# Generate 30 seconds of 1080i HD bars
c = core.colorbars.ColorBars(format=vs.YUV444P10)
c = core.std.SetFrameProp(clip=c, prop="_FieldBased", intval=vs.FIELD_TOP)
c = core.resize.Point(clip=c,format=vs.YUV422P10)
c = c * (30 * 30000 // 1001)
c = core.std.AssumeFPS(clip=c, fpsnum=30000, fpsden=1001)

# Generate 60 seconds of annoyingly "correct" NTSC bars
c = core.colorbars.ColorBars(format=vs.YUV444P12, resolution=0, compatability=0)
c = core.std.SetFrameProp(clip=c, prop="_FieldBased", intval=vs.FIELD_BOTTOM)
c = core.std.Crop(c, 4, 4)
c = core.resize.Point(clip=c,format=vs.YUV422P8)
c = c * (60 * 30000 // 1001)
c = core.std.AssumeFPS(clip=c, fpsnum=30000, fpsden=1001)

# Generate UHD Bars with Rec.2020 primaries
c = core.colorbars.ColorBars(format=vs.YUV444P12, resolution=5, wcg=1)
c = core.resize.Point(clip=c,format=vs.YUV422P10)
c = core.std.AssumeFPS(clip=c, fpsnum=50, fpsden=1)

# Generate HLG UHD Bars
c = core.colorbars.ColorBars(format=vs.RGB30, resolution=5, hdr=1)
c = core.resize.Point(clip=c,format=vs.YUV422P10,matrix_s="2020ncl")

Installation

pip

pip install vapoursynth-colorbars

Meson (from source)

meson setup build
meson compile -C build

Requires VapourSynth >= R74.

Windows (MinGW-w64 one-shot)

gcc -shared -o colorbars.dll colorbars.c -I include/vapoursynth -O3 -std=c99 -Wall

Project details


Download files

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

Source Distribution

vapoursynth_colorbars-6.tar.gz (23.2 kB view details)

Uploaded Source

Built Distributions

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

vapoursynth_colorbars-6-py3-none-win_amd64.whl (29.1 kB view details)

Uploaded Python 3Windows x86-64

vapoursynth_colorbars-6-py3-none-musllinux_1_2_x86_64.whl (28.6 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

vapoursynth_colorbars-6-py3-none-musllinux_1_2_aarch64.whl (28.9 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

vapoursynth_colorbars-6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (28.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

vapoursynth_colorbars-6-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (29.0 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

vapoursynth_colorbars-6-py3-none-macosx_11_0_arm64.whl (35.2 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

vapoursynth_colorbars-6-py3-none-macosx_10_15_x86_64.whl (42.9 kB view details)

Uploaded Python 3macOS 10.15+ x86-64

File details

Details for the file vapoursynth_colorbars-6.tar.gz.

File metadata

  • Download URL: vapoursynth_colorbars-6.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vapoursynth_colorbars-6.tar.gz
Algorithm Hash digest
SHA256 670b9e6208526f33eb8c0d04319233edb07abaef050c0af62db50fa3da2dde14
MD5 204962ba6d9323a519d71a7393d0faab
BLAKE2b-256 12265f7fe13ba1851b3a428eadf85fec2826c3400513b377ff4a0dbe2ba0027a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6.tar.gz:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5ece2047a57b88b319e36618db3365d638ec20561c5ea52525e5e4fe23906319
MD5 d52fbb0810cb0fb0050662bb7cc8f37b
BLAKE2b-256 e5792503eab412ea1b429dfa9aebd72078888042ef695831f7ac950ba3899089

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-win_amd64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cbc520cfbfc8d8ecf9254f8bcc8d20966b803b55bd7de087c32bf70938ad8ef2
MD5 589fc142f858b90a6fb12ddf4f4f1a82
BLAKE2b-256 89923b9d3ada339d2ea18ba1f7f0c08d1d786704f6a4d14020868422ad9e8467

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-musllinux_1_2_x86_64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 50857a07c1460d00e8fd76b5915a8c595d1ee092d8a67bc3395d6858bca35fc7
MD5 679a475d97ed97b37018cab5151173b6
BLAKE2b-256 3a631b2441feeda0cc1fae16d1da1498c01b27a75af4d8e32a5a4cf6e497d3b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-musllinux_1_2_aarch64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 67affed50d60c69312d32dd027e7f12e2e33cb90450baf5698885bb3812c083a
MD5 d4ada791df66a36739b9306ac3dce009
BLAKE2b-256 1a86d56be6e2fc70e7a5dc68d0854483259f62ad9613ac5c8c3e128fa6412848

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2a001102c33a83511614fac025443dbcc8a85e9a12091c506e2582c40e9a0181
MD5 29b49d61f19decf15a8a52143bf66f3d
BLAKE2b-256 f557f0e2340aa19d5037e6339897d185af1227cd037cce10325d5f98c77a3614

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e52ebac81c04c7a22b75102820607c245377ad8be1757146dace4b241c88fec
MD5 a3ce757525b86614d52bc9a15ffcfa60
BLAKE2b-256 b8f2affac32fdc662483438a849e081b11425ac8ea8d31df96550a0fd2151027

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-macosx_11_0_arm64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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

File details

Details for the file vapoursynth_colorbars-6-py3-none-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_colorbars-6-py3-none-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 3935412cdc6f8a66c3da5fa0766015cfc68bcd62ee9a286b631a681d84213261
MD5 cdf820ba8c3cc849c117fff29e404c40
BLAKE2b-256 08473fea5c3881db8226d90eff47e556f7816eb5ab20e2a89697e767e7816209

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_colorbars-6-py3-none-macosx_10_15_x86_64.whl:

Publisher: build.yml on ifb/vapoursynth-colorbars

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