[FFmpeg-devel] [PATCH 1/3] closed caption decoder: accept and decode a new codec type of 'raw 608 byte pairs'

Devin Heitmueller devin.heitmueller at ltnglobal.com
Tue Jun 20 17:34:38 EEST 2023

Hi Roger,

On Mon, Jun 19, 2023 at 8:50 PM Roger Pack <rogerdpack2 at gmail.com> wrote:
> OK updated patches to work with latest git master, made coded id less verbose.
> These have been tested against a "real device" and seem to work properly.
> I'd like to get feedback on the Closed caption decoder first if that's possible.
> I pinged the decoder "maintainer" about it once and didn't get a
> response so seems it's up to us.
> Thank you.
> -=roger=-

First off, to be clear, I'm generally supportive of your efforts to
extend the DirectShow interface to support delivery of 608 captions.
That said, I have some concerns about the specific approach you've
taken, and in particular the notion of introducing a new codec type.

It's been a while since I've looked at the BDA interface for the VBI
slicer, but IIRC there are two CC output pins, and the first one
delivers the sliced byte pairs for CC1/CC2 and the second pin delivers
CC3/CC4.  Your patch to the Directshow driver though only operates on
the first pin, so any captions on CC3/CC4 would be lost.

Further, your new codec provides no way to know whether the packets
containing the byte pairs are for CC1/CC2 or CC3/CC4.  We need to be
able to distinguish between the two, since knowing which service is
carrying the captions is important and some data types (e.g. XDS) are
only delivered on certain services.  The original AV_CODEC_ID_EIA_608
codec allows downstream components processing the packets to know
which pair it is based on the prefix byte.

My inclination is that adding a new codec type creates additional
maintenance headaches, as various components needs to be modified to
handle both codecs, and in fact the *only* difference between your
codec and the existing one is the presence of the prefix byte (which
is actually needed in order to tell which pair it is).  So why not
simply have the directshow component add the 0xFC byte to the front of
the payload for CC1/CC2 and 0xFD for CC3/CC4?  Doing this would allow
everything else to stay the same and no additional codec would be
required?  It would also allow you to add support for CC3/CC4 after
wiring it up to the other CC output pin on the BDA VBI slicer?

In other words, it seems like a 1-line change to the dshow patch would
eliminate the need for the first patch completely.

On a side-note, it's probably worth noting that using a three-byte
payload predates CEA-708.  The prefix byte was present in earlier
standards such as use in DVD GOPs, although the actual structure of
the prefix byte differs in various standards.  While the format for
the ffmpeg codec does match what's found in CEA-708, that's mostly
just for the sake of consistency.


Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com  e: devin.heitmueller at ltnglobal.com

More information about the ffmpeg-devel mailing list