[MEncoder-users] ATSC closed captioning

Scott W. Larson scowl at wballphotos.com
Sun Nov 7 20:24:38 CET 2010


On Sun, 2010-11-07 at 19:02 +0100, Reimar Döffinger wrote:
> I think it "works" with -subcc, I remember getting some results
> for a digital TV sample.

The closed captions in ATSC are identified in the MPEG-2 user data area
with a special tag ("GA94") to separate them from other ATSC data like
AFD. The EIA-608 captions are mixed in with the newer CEA-708 (DTVCC)
captions (stations must include both for backward compatibility) so to
display the EIA-608 captions, you need to extract only the characters
that are tagged as EIA-608.

> However, it works really badly: you cannot select which language
> to display if multiple are available, and you do get missing
> or broken subs regularly.

I don't think multiple EIA-608 captions are supported at all in ATSC.
All captions were CC1 data. The CC2 data was for program and station ID,
content rating and stuff like that. CEA-708 supports up to 63 caption
streams.

The biggest problem is that the caption data arrives with the frames
associated with the captions. That means they'll be out of order as they
arrive so you have to put them back in order. My code stored them in a
linked list in pts order and sent them to the existing EIA-608 caption
code when the frames were displayed.

Unfortunately I found some bugs in the existing caption code and had to
make some improvements. Since I don't have any other EIA-608 test cases,
I had no idea if I was breaking things. The code was really old but for
all I know it had been working perfectly for earlier caption systems.

Another problem was that stations weren't very good at sending EIA-608
data. Characters were regularly dropped. I spent months dumping the
entire user data looking for these missing characters and never found
them. I had to conclude that stations just aren't sending them. Also
some stations were just beginning to support ATSC and were displaying
captions from their SD feeds which were several seconds early or late. I
figured the code would bring endless reports of dropping characters in
captions or displaying them out of sync. Things may have improved since
then.

Also back in 2005, if you submitted code here that had a superfluous
cast or needlessly initialized a variable, you were publicly declared an
idiot even if everything worked. I already know I'm an idiot, thank you
very much!

I still have the old patch if anyone wants to do anything with it. It
has lots of comments.

> Unfortunately I haven't been able to match any specification
> up with the data that is actually in those streams, and I
> have neither enough samples nor do I care enough to reverse-engineer
> the format.

No need to reverse engineer. All ATSC specs are published and
well-documented, either in the documents at atsc.org or on wikipedia.
Even I was able to figure out how to display the EIA-608 data. The
CEA-708 captions would require serious graphic support since it can
create text windows, change font colors, and draw captions aligned with
nine different screen locations.

Also, I think belongs in the mplayer-dev list.



More information about the MEncoder-users mailing list