Log in

View Full Version : Help extracting encoded closed captions from VHS


eXtremeDevil
24th September 2024, 13:47
I just bought a PAL VHS from UK and it seems to have encoded closed captions. Here's a sample:

https://mega.nz/file/JQxS0QJa#akbOgHcCEYXShsM9QLCd3z5Px1_ftzKYMxJ-Q5J2ht8

The encoded CC line can be seen on top. This is a lossless video and audio file.

I've been reading and for NTSC videotapes the CC seems to be on line 21, but being a PAL VHS I don't know if the line number has changed.

How can I extract that data? Can I do it with my USB capture device and a PC? Do I need some advanced hardware?

I've read something about GraphEdit and GraphStudioNext, but, apart from being completely lost with those apps, I don't know if I'm missing something.

Thanks in advance.

Emulgator
24th September 2024, 19:04
Could be line 22 UK subs EIA-608 aside from teletext, or ceefax ?
https://en.wikipedia.org/wiki/Teletext
https://news.ycombinator.com/item?id=34106832
https://joeclark.org/access/captioning/econcc.html
Anything that captures this line is good, decoding comes later.
As long as played from a S-VHS player your capturing device should see it.
Seems simple as bread: 16 positions flip bitwise.
https://superuser.com/questions/1221713/ffmpeg-to-decode-closed-captions

eXtremeDevil
24th September 2024, 19:25
Could be line 22 UK subs EIA-608 aside from teletext, or ceefax ?
https://en.wikipedia.org/wiki/Teletext
https://news.ycombinator.com/item?id=34106832
https://joeclark.org/access/captioning/econcc.html
Anything that captures this line is good, decoding comes later.
As long as it is on VCR tape, your capturing device should see it.
Seems simple as bread: 16 positions flip bitwise.
https://superuser.com/questions/1221713/ffmpeg-to-decode-closed-captions

Hi Emulgator, thanks for your answer. It could be line 22 UK subs EIA-608, but I really don't have any idea. I don't know if you've checked the sample I uploaded. I captured it with FFMPEG, with a lossless video and audio codec, with a SCART to composite video cable adapter to a cheap capture device (conexant based): https://www.amazon.co.uk/August-Capturadora-Transferencia-Compatible-Windows/dp/B008F0SARC

We're of course not talking about hardcoded subs, but a hidden signal (I don't know exactly how it works) that can be seen on the top of the video.

This is the point where I get lost. Do I need a special VCR to decode (not show or see) the signal? Can my capture device decode/grab it? Will my simple VCR scart output work?

I tried with GraphEdit but the one I downloaded does not have the required DirectShow filter, but at this point I'm starting to think that maybe my VCR or output connector may not be compatible with this signal type.

I've also read something about GraphEdit needing the live video capture from the VCR, meaning that my FFMPEG generated file has no CC data signal anymore, apart from that weird white blinking line on top.

I definetely need more info about this, do I need some special VCR or mandatory composite or S-Video output? Do I need a special adapter? And most importantly, apart from that, how do I actually extract that information?

I'm afraid this VHS is one of a kind and there is no DVD or BD with this data, nor subtitles online whatsoever.

I hope you guys will clarify some things for me.

Thanks in advance, as usual.

Emulgator
24th September 2024, 20:19
It is already in the capture, so your chain did not miss it. Now follows decoding.
This can be even be written as AviSynth script, (crop to line 0, crop 17? times),
return Y-values, assign 17 bits and decode) if it does not exist already somewhere else.

eXtremeDevil
24th September 2024, 20:24
It is already in the capture, so your chain did not miss it. Now follows decoding.
This can be even be written as AviSynth script, (crop to line 0, crop 17? times),
return Y-values, assign 17 bits and decode) if it does not exist already somewhere else.I'm actually familiar with avs scripts, but I don't think I follow you, at least not all the steps.

I could crop the top part and resize it or something like that, but I'm loss at the decode part.

On the other hand, what would I actually get? Hardcoded subs in an output video?

Thanks!

Emulgator
24th September 2024, 20:42
Decoding means to implement a EIA-608 decoder. I have none at hand.
Then render results to what you prefer, text is also possible.
https://forum.doom9.org/showthread.php?t=183190

eXtremeDevil
24th September 2024, 20:48
Decoding means to implement a EIA-608 decoder. I have none at hand.
Then render results to what you prefer, text is also possible.
https://forum.doom9.org/showthread.php?t=183190I didn't know such decoders existed for avisynth. I will investigate them. Thanks.

Emulgator
24th September 2024, 20:55
The link only is about text import/export.
BTW, FrameEvaluate() seems the way to go.
Below just for fun, not real decoding.
LWLibavVideoSource("C:\1.mkv")
ConvertToYV24()
Crop(0,0,-0,-575)
Crop(237,0,-20,-0)
bw=27 #barwidth
#17 Bars ?
c0=Crop(bw*0,0,bw,0)
c1=Crop(bw*1,0,bw,0)
c2=Crop(bw*2,0,bw,0)
c3=Crop(bw*3,0,bw,0)
c4=Crop(bw*4,0,bw,0)
c5=Crop(bw*5,0,bw,0)
c6=Crop(bw*6,0,bw,0)
c7=Crop(bw*7,0,bw,0)
c8=Crop(bw*8,0,bw,0)
c9=Crop(bw*9,0,bw,0)
c10=Crop(bw*10,0,bw,0)
c11=Crop(bw*11,0,bw,0)
c12=Crop(bw*12,0,bw,0)
c13=Crop(bw*13,0,bw,0)
c14=Crop(bw*14,0,bw,0)
c15=Crop(bw*15,0,bw,0)
c16=Crop(bw*16,0,bw,0)
return(StackVertical(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16))

eXtremeDevil
24th September 2024, 22:00
The link only is about text import/export.
Below just for fun, not real decoding.
LWLibavVideoSource("C:\1.mkv")
ConvertToYV24()
Crop(0,0,-0,-575)
Crop(237,0,-20,-0)
bw=27 #barwidth
#17 Bars ?
c0=Crop(bw*0,0,bw,0)
c1=Crop(bw*1,0,bw,0)
c2=Crop(bw*2,0,bw,0)
c3=Crop(bw*3,0,bw,0)
c4=Crop(bw*4,0,bw,0)
c5=Crop(bw*5,0,bw,0)
c6=Crop(bw*6,0,bw,0)
c7=Crop(bw*7,0,bw,0)
c8=Crop(bw*8,0,bw,0)
c9=Crop(bw*9,0,bw,0)
c10=Crop(bw*10,0,bw,0)
c11=Crop(bw*11,0,bw,0)
c12=Crop(bw*12,0,bw,0)
c13=Crop(bw*13,0,bw,0)
c14=Crop(bw*14,0,bw,0)
c15=Crop(bw*15,0,bw,0)
c16=Crop(bw*16,0,bw,0)
return(StackVertical(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16))

Yes, the link you provided is for exporting only, not decoding, I got that part xD

About the script you provided, I don't really get it. I only see white lines. I know you said it's for fun only and not real decoding, but I have no idea on how to decode those images. I've searched for avisynth VHS CC decoders but I found nothing.

eXtremeDevil
24th September 2024, 22:39
I've been trying all days with tools and instructions from here:

http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_TOOLS.HTML

But the more I read, the less I understand, especially the capturing part. It seems like I would need some special hardware to capture. And also GraphEdit doesn't work, probably Win10 is too advanced for it.

Emulgator
25th September 2024, 13:29
BTW, for placing and tapping the "CC Decoder filter" on capture: GraphStudioNext:
https://github.com/cplussharp/graph-studio-next/releases/tag/v0.7.3.1
Microsoft tells that it was a filter available within DirectShow from Win2000 trough WinXP, but removed from Vista on.
Well, DirectShow has not ceased to exist.

Aside from capturing in realtime it still can be dedoded using a frameserver, the file with the bitflipping line 0 is already there.
Unfortunately I have no time now for a walkthrough, but here is just a preview how the bitsetting function could look like:
(appended from above, last line commented out: #return(StackVertical...)
global th=63
function bitset (c0){file = "C:\bit0.txt" b0=FrameEvaluate(c0, "AverageLuma() < th ? 0 : 1") c0= WriteFile(c0, file, "b0") return c0}
bitset(c0)
Running that script indeed writes a text file for the leftmost of the bitpositions, but contains 4 complaints "I don't know what 'b0' means."
For now I haven't had time to fix the syntax, it may be just a wrong variable.
Still no decoding, but at least a start for a willing user to hack upon.
Byte pair format is defined in EIA/CEA-608-B.

eXtremeDevil
25th September 2024, 14:31
I'm totally loss by that code :S

EDIT

Actually, I get the part where you said my file already contains the CC. I understand that I need to decode it. But I have literally no idea about it. I thought some tool would be available already, because otherwise I have a total lack of knowledge to write my own decoder :(