Shop OBEX P1 Docs P2 Docs Learn Events
Closed Captioning for the Debug-Impaired — Parallax Forums

Closed Captioning for the Debug-Impaired

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2006-09-12 00:06 in Propeller 1
Attached is an archive that demonstrates a closed captioning object I'm working on. Closed captioning ability is mandated by the FCC for all TV receivers 13" or larger. It allows text to be encoded in line 21 of the video signal, two characters per field of video. I'm using only one of the two available fields, so this works out to two characters per frame, or 600 baud. When captioning is enabled on the TV (usually by a "Menu" selection from the remote), a portion of the picture is blacked out and replaced by the captioning data. Depending on the captioning mode, this could be dialog (in one of two languages), sports scores, news headlines, etc.

For debugging purposes in a Propeller video app, closed captioning has the advantage of not occupying any of the application's screen real estate. It appears in a separate overlay window which can be turned on or off by the user at will. You can use it to monitor variables and inputs, for example, without having to accommodate them within the normal video output.

This is a very early stab at a usable object. Closed captioning uses a rather arcane set of command sequences for setting modes, colors, cursor positions, etc. I haven't yet written any subroutines to encode them from a more approachable command set. So to use it, you need to know the magic words and secret handshakes. These are all contained in Keith Jack's excellent Video Demystified. You can also find them here: www.fcc.gov/oet/info/rules/part15/part15-2-16-06.pdf, starting on page 45.

Anyway, here it is — as is — to try. I'd be interested in hearing about any successes, failures, or quirks you experience. My TV monitor, for example (a Panasonic 13" model from Costco), inserts extra spaces for every command sequence it sees. Monitors smaller than 13" and those not designed for broadcast reception may not work at all, since they're not required to support closed captioning. Also, bear in mind that the closed captioning protocol is stateful. This means that if you want to turn it on and off at your TV monitor, your program will have to resend the configuration commands on a periodic basis. Otherwise the TV won't know what to do when you turn captioning on.

The object captioner.spin gets its synchronization from the TV.spin object, which is required to be running. I've set the video output base pin to 24. Many of you will want to change that to 12 for use with the Demo Board and, probably, most PropSTICK setups.

Cheers!
Phil

Post Edited (Phil Pilgrim (PhiPi)) : 9/5/2006 6:15:46 PM GMT

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-09-05 20:05
    Wow tre excellent Phil, Id test it out but my TV is pre-FCC regulation. I wonder if my TV-tuner card is CC-enabled, I'll have to check on it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ...
  • dfleigdfleig Posts: 1
    edited 2006-09-06 23:32
    Wow! I just happened to be connecting an LM1881 to my prop when I noticed your post. I think CC might be a neat and, now, much easier way to embed telemetry data into the video stream from my RC helicopter so your object is very timely indeed.

    The object seems to work OK on my cheap Magnavox TV/DVD combo but I haven't beat on it much yet. I did get paint-on captioning working using the PDF doc you included as a guide but pop-on isn't cooperating yet. I'm hoping this weekend will give me more time to play as well as dig into the code.

    David
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-09-07 05:24
    David,

    Well, you've taken this way beyond what I've done with it so far! I'm curious: did your TV add extra spaces where the commands were sent? (These will show up as gaps in the demo output where the colors change.)

    I think the CC method is an excellent way to add telemetry data to a video stream and shouldn't be too hard to pull off, since you don't have to genlock to the chroma signal. The major disadvantage, of course, is the low baudrate, which could put the telemetry several frames behind the video it applies to. But if you record the video, being able to switch the text on and off at will during playback confers a tremendous advantage over more conventional overlay techniques.

    BTW, if you try the '1881, use the composite sync output, and just ignore the vertical and even/odd outputs. The program can deduce these from the composite sync.

    I tried putting data in both fields (lines 21 and 284), but didn't get reliable output, there being a lot of missing characters. Solving this would effectively double the baudrate, though.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-09-11 05:02
    Phil,

    I was watching the NASA channel the other day after the recent launch, and noticed about 1/3rd of the way down on the video feed from the shuttle there appeared to be a ticker tape style data transmission.
    It looked to be an alternating 3 byte or 4 byte data packet. Any ideas on what that would be? Just thought it was interesting... even more so to "read" what it is. I assume it's some sort of CC telemetry, perhaps
    astronaut vitals.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-09-11 07:17
    Beau,

    I went over there and checked. The "data strip" was about halfway down when I first looked and gradually moved up the screen. My guess is that it's not data, but an artifact from the video data compression and display being out of sync with the original feed. I actually see the same thing with the PropCAM when the frame capture isn't programmed to sync with the outgoing video. Except, in the PropCAM's case, there isn't a black line with crawling white stuff -- just a discontinuity in the grayscale display that moves up the screen. That black and white stuff might be a hiccup in the compression algorithm when confronted with lines from two different frames.

    -Phil
  • bparbpar Posts: 1
    edited 2006-09-11 17:09
    It is video time tagging data, specifically Greenwich Mean Time (GMT) and it only shows up when certain shuttle cameras and the GMT inserter are running asynchronously, otherwise it goes in the vertical interval like cc data.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-09-11 18:10
    Ah, so. Makes sense. Here's a document describing NASA's CCTV system:

    www.shuttlepresskit.com/scom/23.pdf#search=%22nasa%20video%20time-tag%20sync%22

    The out-of-sync time tag is described on page 6.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-09-11 18:59
    Interesting,

    Phil I didn't mean to Off Topic your thread.
    From pg 6
    "Crews and flight controllers will see this as a thin, flashing, segmented white line that scrolls across the screen of the color monitors and in the downlink video."

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-09-11 19:32
    Heck, it seemed on-topic to me -- plus it turned up an interesting tidbit about NASA! smile.gif

    Video Demystified describes a vertical interval timecode (VITC), which may or may not be the same thing that NASA uses. Whereas closed captioning only gets 17 bits of data between horizontal syncs, the VITC message is 90 bits (about 0.55uSec each), with the time data encoded in BCD.

    -P.
  • Ym2413aYm2413a Posts: 630
    edited 2006-09-11 19:47
    Interesting enough, The FCC requires the company I work for to CC all television programing over 30 seconds long.
    This object might have more uses then just debugging.

    It could be used to overlay important information that could be turned on or off.
    Now only if someone can come up with a way to inject the CC into line 21 of a incoming video signal, much like overlaying graphics over a signal only this would be done on Line 21 only.

    As for those who have never seen CC on line 21 before.
    It looks like a grey bar with random jumping patterns on a monitor with overscanning.
    Some of our high end capture-cards at the TV studio support video compression that doesn't compress line 21 but every other part of the picture with M-jpeg. This way you can lossy compress the video and not kill the CC signal.

    Well sorry if this is sort of off topic.
    Many thanks to Phil for this great object.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-09-11 21:19
    Phil,

    Fair enough

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • HarleyHarley Posts: 997
    edited 2006-09-11 23:02
    Phil said...

    ....

    The object captioner.spin gets its synchronization from the TV.spin object, which is required to be running. I've set the video output base pin to 24. Many of you will want to change that to 12 for use with the Demo Board and, probably, most PropSTICK setups.
    Wow! That's really neat, Phil. I hoped my tiny 5" CRT monitor would work. Well, didn't help to not pay attention to your last paragraph on 'basepin' change. Of course, nothing showed on screen. redface.gif
    Figured it had to be VGA, then re-read the above. Simple edit and voil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-09-11 23:22
    Uh, oh, Harley. I'm afraid my demo was a little misleading. The "Closed Captioning Demo" text comes from tv_wtext. The real closed captioning stuff is supposed to appear as four lines on the bottom of the screen in multiple colors and constantly scrolling. I suspect your 5" monitor is not CC-enabled, since it's smaller than the 13" size threshold set by the FCC.

    My apologies to anyone else who tried this and thought the title text was the closed captioning data.

    -Phil
  • Ym2413aYm2413a Posts: 630
    edited 2006-09-12 00:06
    subtitles.jpg

    Here, This is what Closed Captioning should look like on a video signal viewed on a TV.
    Be sure to enable it on your television set first or that black box won't show up. (This is why it's called "Closed" caption and not "Open")

    Closed captions can be enabled or disabled unlike open captioning.
    Your TV then overlays the Closed Caption onto a part of the screen if it's enabled.

    It was designed for those who are hard of hearing, but in professional video it has found other uses like Cue point marking and Time Codes.
Sign In or Register to comment.