Skip to main content

dvdcc

dvdcc

Put line-21 closed captions (CEA-608, CC1) into the MPEG-2 video of a DVD, without re-encoding it. Pure Python, no dependencies.

  • From a Scenarist (.scc) file: the byte pairs caption tools write are used as they are, from the frame of their timecode.
  • From subtitles (SubRip, WebVTT, ASS / SSA, text scripts; UTF-8, UTF-16 or Shift_JIS): each is sent as a pop-on caption.
    • It is loaded into the hidden memory before its time, shown at its start, and erased at its end.
    • Long lines are wrapped to 32 columns and 4 rows.
    • A caption with too much text to load in time is shown late, with a note.
  • Into the video: the captions go into the stream as the DVD's GOP user data (00 00 01 B2 'C' 'C' 01 F8), one word pair per frame. This is the data a DVD player sends to line 21.

日本語の説明は README.ja.md にあります。

Why

Plenty of tools read DVD captions back, but very few put them in. ffmpeg cannot embed .scc files. The open caption libraries that write CEA-608 target H.264 and HEVC (A/53 SEI), not the DVD's MPEG-2 user data.

Install

pip install dvdcc

A release is made by the version: when the version in pyproject.toml (and dvdcc/__init__.py) reaches main without a tag of its own, .github/workflows/release.yml runs the tests, builds the package, makes the GitHub release with its tag and publishes to PyPI (trusted publishing, environment pypi). Merging the version bump is all it takes.

Use

dvdcc video.m2v captions.scc              # in place
dvdcc video.m2v subs.srt -o captioned.m2v --offset 01;00;00;00
dvdcc check subs.srt                      # what captions cannot carry as written, cue by cue
dvdcc contract --json                     # machine-readable contract (AI Video Production OS registry)

contract/contract.json is that contract committed as a file (the contract --json output, unchanged), so any release's contract is git show vX.Y.Z:contract/contract.json, with nothing installed or run. Regenerate it with python contract/generate.py after a contract change or a version bump; a unit test fails when it is stale.

A pop-on caption holds 4 rows of 32 characters from the caption character set. dvdcc check (or --json) names every cue that goes past that, and what happens to it; a caption run sends every cue all the same and prints the same lines as notes:

$ dvdcc check tests/fixtures/subtitle_skill.srt
tests/fixtures/subtitle_skill.srt: cue 2 at 00:00:03.500: line 1 is 40 characters, a caption row holds 32: wrapped onto 2 rows
tests/fixtures/subtitle_skill.srt: cue 3 at 00:00:06.500: 8 character(s) have no closed-caption character and become spaces: 日本語の字幕です
tests/fixtures/subtitle_skill.srt: 2 of 4 cue(s) cannot be carried as written
from dvdcc import captions

schedule, notes = captions.load("subs.srt")      # or a .scc; notes: what did not fit
frames = captions.inject_file("video.m2v", schedule)

Then mux and author the disc as usual. Tell the authoring tool that the titleset has line-21 captions, so players that look find them. With dvdauthor, that is <video ... caption="field1"/>.

Limits:

  • NTSC only, since line 21 belongs to the 525-line picture.
  • 29.97 frames per second. Film with soft 3:2 pulldown counts its fields differently, so it is not supported.
  • Field 1 (CC1) only.

Tests

python -m unittest discover -s tests -t .

The tests cover:

  • the caption bytes: parity, preamble address codes, the character set;
  • pop-on timing and Scenarist parsing;
  • the limits report: subtitle files as subtitle-skill writes them, with a 40-character line and a Japanese line, both reported;
  • the user data layout;
  • with ffmpeg, captions put into a test video that ffmpeg's own caption decoder (lavfi subcc) reads back as the text at the right times;
  • with dvdauthor as well, a whole authored disc whose VOB decodes to the captions and whose IFO marks line-21 captions.

dvdcc was first written for oncemore, a DVD and Blu-ray authoring app.

Support

dvdcc is free and stays free. If it saves you time, you can support its development through GitHub Sponsors (the Sponsor button at the top of this repository). Bug reports help just as much: Issues.

The logo, colours and writing rules: docs/DESIGN.md.

License

Apache License 2.0. See LICENSE and NOTICE.

Metadata

Release files for dvdcc 0.2.1

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

Source distribution (sdist)

Source distribution for dvdcc 0.2.1
File Size Uploaded Provenance Actions
dvdcc-0.2.1.tar.gz 28.3 kB With provenance Details for dvdcc-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dvdcc 0.2.1
File Interpreter ABI Platform Actions
dvdcc-0.2.1-py3-none-any.whl Python 3 none any Details for dvdcc-0.2.1-py3-none-any.whl

Total release size: 49.9 kB

Release files / dvdcc-0.2.1.tar.gz

Download URL dvdcc-0.2.1.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cf4eb266a098c77a7a6683c1a44b747b0554943f6d3ee42a812053d606be8053
BLAKE2b-256 checksum
How to use checksums
b39c0ea3185bd4ae08b30aacd1c0732031dfd457ccf523c516971bcc426eb1b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Release files / dvdcc-0.2.1-py3-none-any.whl

Download URL dvdcc-0.2.1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
527ecef4264e7173bc57871d3bee8cb2b982ac1e825a906c88cc34b9eec9b8e5
BLAKE2b-256 checksum
How to use checksums
77c6356abcbae424cc60adb506473faf945f6abe5e72aaddd33b2966a30563d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for dvdcc 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dvdcc-0.2.1.tar.gz

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 Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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