happycube / ld-decode

Software defined LaserDisc decoder
GNU General Public License v3.0
310 stars 80 forks source link

Support VBI output as per the linuxtv raw VBI format #284

Open simoninns opened 5 years ago

simoninns commented 5 years ago

See: https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/dev-raw-vbi.html#raw-vbi

Unless anyone knows of a more suitable output format for external tools?

simoninns commented 5 years ago

There is also a 'sliced' format: https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/dev-sliced-vbi.html

simoninns commented 5 years ago

This is probably best implemented as part of the new ld-discmap tool as that 'preps' the TBC for final output

Gamnn commented 4 years ago

Sounds like a job for ld-export-metadata.

simoninns commented 4 years ago

Working from the JSON metadata won't output any unimplemented VBI lines though (like teletext for example). I think the linuxtv format requires the actual video lines rather than decoded LD-specific VBI data points.

Gamnn commented 4 years ago

Ah, that's true.

I'm uncertain if ld-discmap is the right place for it either, though. At least until it can at minimum pass-through weird ntsc pull-down tbcs if not fully support them. I believe Cinderella PILA-1124 might be one such case, but I'd have to check.

simoninns commented 4 years ago

ld-discmap isn't the right place for it - I think a separate tool would be required to pull the lines from the .tbc and output them in the right format for linuxtv.

atsampson commented 4 years ago

I've been experimenting with libzvbi, which includes both a decoder that extracts various kinds of ("sliced") VBI data from raw images, and pretty complete Teletext and CC renderers.

At present I have the zvbi decoder hooked up in ld-process-vbi, alongside Simon's existing CC decoder, and it seems to extract both PAL Teletext and NTSC CC frames successfully. The next step would be to make it store the "sliced" results in the JSON (as with CC already), then have ld-export-metadata extract it again, feed it into the renderer, and write the result out as subtitle files (or just dump the sliced data out if you want to render the whole magazine with an external tool).

atsampson commented 4 years ago

(That's not to say that this is necessarily the right way to do it in the long run, but I want to see if it works at all before figuring out the right way to do it!)

simoninns commented 4 years ago

If you are happy to code it, you'll get no complaints from me :) Feel free to experiment - it's better for us to discuss results rather than potential results!

atsampson commented 4 years ago

Work in progress on the zvbi branch - ld-export-metadata can now write out Teletext lines in formats that ZVBI's tools and vhs-teletext's tools can work with:

out-100-00

I'm pretty convinced now that going via the JSON is not the right way to handle Teletext, though - it works, but it produces very big JSON files (which JsonWax doesn't handle well), and getting it into and out of the metadata is half the effort...

Edit: It's not nearly as bad (in efficiency or complexity) if you encode the VBI data as a Base64 string rather than an array.

atsampson commented 4 years ago

Worth noting that there's some variation between discs in which lines are used. Using ld-analyse's line numbering system, British Garden Birds and Touch of Evil have Teletext on lines 39-42 (two lines per field), but Glenn Gould's Greatest Hits has Teletext on lines 27-30 and 39-42 (four lines per field).

atsampson commented 1 year ago

vhs-teletext can now read .tbc files, so I don't know if this is still needed...