[MEncoder-users] ATSC closed captioning

Scott W. Larson scowl at wballphotos.com
Mon Nov 8 06:14:12 CET 2010


I've attached the five year old patch in case anyone is interested in
looking into this or wants to encourage me to make a more maintainable
version.

On Sun, 2010-11-07 at 22:16 +0100, Reimar Döffinger wrote:
> In the long-term it would probably be best if libavcodec could extract
> the user data and return it in an AVFrame along with the decoded image.

What I did was a brute force test in process_userdata() in
libmpdemux/video.c (there is already one case for 'CC'; I added
another):

+#ifdef EIA708_CAPTIONS
+/* We'll need the pts to process EIA-708 captions properly */
+static void process_userdata(unsigned char* buf,int len, float pts){
+#else
 static void process_userdata(unsigned char* buf,int len){
+#endif
:
+#ifdef EIA708_CAPTIONS
+    if (buf[0]=='G' && buf[1]=='A' && buf[2]=='9' && buf[3]=='4') {
+     if (subcc_enabled) subcc_save_eia708_packets(buf+4, pts);
+ return;
+    }
+#endif

> Yes, it worked really badly for me, and as said I couldn't really
> find a way to reconcile it with any specs or anything I could find.

I can see how normal EIA_608 captions wouldn't have worked very well
without rollup support.

> I don't know what exactly was going on, however review comments really
> shouldn't be taken personally, there are very few people reviewing code
> and they get to see the same "mistakes" over and over get tired of
> explaining everything, so it can easily sound worse than it was meant...

I believe I was discouraged when one member claimed the submitter of a
patch did not know C because the submitter had a common misunderstanding
about initialized data. This insulting attitude was not something I
wanted to be part of.

> I suspect the reordering code etc. is likely to not be in a way
> I'd like to have for maintainabilty reasons, however the bugfixes
> would be interesting, should make it easier for me to figure out
> which parts of the code I just don't get vs. where the code is broken.

Are you talking about the code in cc_decode_EIA608()? It looks like I
added some channel selecting code, added some code to poorly handle
italics (I just enclosed them between '<>'), and added support for two
line and and three line rollup captions.

I think the linked list code is pretty good and I heavily commented it
in case someone else needs to figure out what I attempted. I've also
heavily commented all the sections regarding caption extraction
including what data I was seeing local stations send.

> > 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.
> 
> I doubt much of that is really necessary for something that works for
> most people.

Most likely just extracting the text and displaying it would be enough.

> However already just reassembling the packets across frames sounds
> like a pain, particularly within the current code.

I think my code does that part correctly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eia708.patch
Type: text/x-patch
Size: 13899 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mencoder-users/attachments/20101107/67ff8394/attachment-0001.bin>


More information about the MEncoder-users mailing list