Author Topic: How to encode captions in line 21 of an NTSC signal?  (Read 1422 times)
Binarix128
Member
*****
Offline

Gender: Male
View Posts
View Gallery
220V AC 50Hz, NTSC


GoL UCOUT2noI2R__jgPSJUjGRtA
How to encode captions in line 21 of an NTSC signal? « on: March 01, 2021, 10:58:36 PM » Author: Binarix128
I wonder how can I encode subtitles from a video file from a computer to a composite video output, for it to be recognized by a TV as closed captions or to store it in a VHS tape. The problem is that HDMI does not support closed captions, only on screen subtitles, and if HDMI happens to support them, I really doubt that my HDMI to AV converter could encode them. There are laptops with native s video outputs, could they work if I play a video with subtitles file? I have DVD movies with subtitles in them, but my DVD player does not display them in line 21, so I cannot burn a DVD with subtitles file.
Logged
Medved
Member
*****
Offline

Gender: Male
View Posts
View Gallery

Re: How to encode captions in line 21 of an NTSC signal? « Reply #1 on: March 02, 2021, 03:03:00 AM » Author: Medved
I wonder how can I encode subtitles from a video file from a computer to a composite video output, for it to be recognized by a TV as closed captions or to store it in a VHS tape. The problem is that HDMI does not support closed captions, only on screen subtitles, and if HDMI happens to support them, I really doubt that my HDMI to AV converter could encode them. There are laptops with native s video outputs, could they work if I play a video with subtitles file? I have DVD movies with subtitles in them, but my DVD player does not display them in line 21, so I cannot burn a DVD with subtitles file.

The question is, whether the NTSC generator is able to include that line 21 into the "active picture", so if it allows to map this line into a frame RAM (so allow the SW to control its content as any other part of the picture) and not into the "border" (the part that has just the hard wired black in it). You may look into the configuration, where you may possibly adjust the pixel size of the active frame area.
If yes, it is just a question of the player SW, if it is able to generate the required signal there (as a white-dark spot sequence). If the NTSC generating HW allows to map the line 21 into the frame buffer, I would guess there would be some SW able to generate the captions there.

Otherwise I think it could be quite nice mcu project (I think ATMega running on selected crystal to allow an easy SW synchronization may do the job)...
Logged

No more selfballasted c***

Binarix128
Member
*****
Offline

Gender: Male
View Posts
View Gallery
220V AC 50Hz, NTSC


GoL UCOUT2noI2R__jgPSJUjGRtA
Re: How to encode captions in line 21 of an NTSC signal? « Reply #2 on: March 02, 2021, 10:20:15 AM » Author: Binarix128
Not my  HDMI to AV converter, nor my computer HDMI output, nor the video player can be configured in such a way to include the 21 in the active video pixels.

Are you speaking about a dedicated circuit to generate line 21? A digital video stabilizer (which passthrough all the active picture lines, and generates its own blanking intervals and lines, used back in the day to bypass Macrovision) modded to generate its line 21 from the live input of an usb, ps2 or COM keyboard, should work perfectly. I wonder if it could be done with arduino or esp32.
Logged
Medved
Member
*****
Offline

Gender: Male
View Posts
View Gallery

Re: How to encode captions in line 21 of an NTSC signal? « Reply #3 on: March 03, 2021, 07:06:33 AM » Author: Medved
Not my  HDMI to AV converter, nor my computer HDMI output, nor the video player can be configured in such a way to include the 21 in the active video pixels.

Are you speaking about a dedicated circuit to generate line 21? A digital video stabilizer (which passthrough all the active picture lines, and generates its own blanking intervals and lines, used back in the day to bypass Macrovision) modded to generate its line 21 from the live input of an usb, ps2 or COM keyboard, should work perfectly. I wonder if it could be done with arduino or esp32.

With Arduino yes, but you would have to likely replace the crystal, so you will be able to get some whole number division factors... And you would have to program it directly in C and assembler, not via the standard Arduino compiler, as that adds a lot of ballast (mainly timing wise).
The esp32 I don't know.
Logged

No more selfballasted c***

Binarix128
Member
*****
Offline

Gender: Male
View Posts
View Gallery
220V AC 50Hz, NTSC


GoL UCOUT2noI2R__jgPSJUjGRtA
Re: How to encode captions in line 21 of an NTSC signal? « Reply #4 on: March 03, 2021, 10:09:38 PM » Author: Binarix128
With Arduino yes, but you would have to likely replace the crystal, so you will be able to get some whole number division factors... And you would have to program it directly in C and assembler, not via the standard Arduino compiler, as that adds a lot of ballast (mainly timing wise).
The esp32 I don't know.

I could burn the program into the chip by the arduino board and the compiler, and then operate it in a separated board with a dedicated crystal, burning it by other way would be too complicated. I wonder if the arduino chip supports an USB or PS2 keyboard interface, and make a buffer of the characters, for write captions in real time.

I also wonder if a circuit that shifts to another composite video input when it detects a certain color burst phase shift, given by a potenciometer or trimmer could be done in an arduino based circuit. But for that both composite video signals must be in sync,  which could be pretty tricky.

There are many things that could be done with composite video, but creating a circuit for that could be tricky.
Logged
Medved
Member
*****
Offline

Gender: Male
View Posts
View Gallery

Re: How to encode captions in line 21 of an NTSC signal? « Reply #5 on: March 04, 2021, 03:44:19 AM » Author: Medved
I could burn the program into the chip by the arduino board and the compiler, and then operate it in a separated board with a dedicated crystal, burning it by other way would be too complicated. I wonder if the arduino chip supports an USB or PS2 keyboard interface, and make a buffer of the characters, for write captions in real time.

I also wonder if a circuit that shifts to another composite video input when it detects a certain color burst phase shift, given by a potenciometer or trimmer could be done in an arduino based circuit. But for that both composite video signals must be in sync,  which could be pretty tricky.

There are many things that could be done with composite video, but creating a circuit for that could be tricky.

"Arduino chip" is nothing else than an ATMEGA328 (or some similar AVR).
The problem is, once you connect a different crystal, the UART communicaton with the USB chip on the arduino board will fall apart, so even the Arduino downloader won't work anymore.
But you may actually use an Arduino board to work as the ATMEGA ISP programmer device (there are plenty of sketches for this function) and program another ATMEGA chip from it.
So you may take an ATMega chip, with the crystal corresponding to the NTSC.

I don't know the subtitles format, does it really need sync with the color burst, or V/H is just enough?
Logged

No more selfballasted c***

Binarix128
Member
*****
Offline

Gender: Male
View Posts
View Gallery
220V AC 50Hz, NTSC


GoL UCOUT2noI2R__jgPSJUjGRtA
Re: How to encode captions in line 21 of an NTSC signal? « Reply #6 on: March 04, 2021, 08:40:49 AM » Author: Binarix128
"Arduino chip" is nothing else than an ATMEGA328 (or some similar AVR).
The problem is, once you connect a different crystal, the UART communicaton with the USB chip on the arduino board will fall apart, so even the Arduino downloader won't work anymore.
But you may actually use an Arduino board to work as the ATMEGA ISP programmer device (there are plenty of sketches for this function) and program another ATMEGA chip from it.
So you may take an ATMega chip, with the crystal corresponding to the NTSC.

I don't know the subtitles format, does it really need sync with the color burst, or V/H is just enough?
So I write the program on the arduino board, and then I take the ATMega out and I wire it in a proto board with a different crystal, sounds simple though. What crystal should be used? Divisible by the H sync, by the V sync or the entire bandwidth? The caption encoding is simple, just a straight stream of binary info over line 21, one line for each character, the character output is given by a chart. Now the thing is to use a keyboard to write the captions.

The color burst sync was for another thing, a crude analog video "chroma keyer".
Logged
Medved
Member
*****
Offline

Gender: Male
View Posts
View Gallery

Re: How to encode captions in line 21 of an NTSC signal? « Reply #7 on: March 04, 2021, 11:18:31 AM » Author: Medved
You need to synchronize to all V, H and be able to generate the correct data timing, all that with sufficient margin for enough instruction between the edges.
The data is UART based (start, 7 or 8 data, optional parity, stop), or a long stream of bits? Did not found the timing...

The question is, if it would be possible to use the HW serial interface, or better to go bitbang with SW timing...
As I'm writing it, I would more lean towards interrupt triggered routine generating the data for the single line by the SW timed bitbang and let the serial interface do the UART thing from the computer (via some USB - serial converter chip).
I would let the video signal original just past the color burst of the line 21 and after it take over the signal, send the data burst and then, before the H pulse, switch back to the original.

I think there should be some player SW available to let you redirect the CC data to the COM, where the title injector will be sitting...
Logged

No more selfballasted c***

Print 
© 2005-2024 Lighting-Gallery.net | SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies