ld-decode icon indicating copy to clipboard operation
ld-decode copied to clipboard

Support VBI output as per the linuxtv raw VBI format

Open simoninns opened this issue 5 years ago • 12 comments

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 avatar Jul 04 '19 03:07 simoninns

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

simoninns avatar Jul 04 '19 03:07 simoninns

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

simoninns avatar Aug 19 '19 04:08 simoninns

Sounds like a job for ld-export-metadata.

Gamnn avatar Jan 08 '20 06:01 Gamnn

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.

simoninns avatar Jan 08 '20 07:01 simoninns

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.

Gamnn avatar Jan 08 '20 07:01 Gamnn

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.

simoninns avatar Jan 08 '20 07:01 simoninns

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 avatar Jan 08 '20 11:01 atsampson

(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!)

atsampson avatar Jan 08 '20 12:01 atsampson

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!

simoninns avatar Jan 08 '20 12:01 simoninns

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 avatar Jan 09 '20 00:01 atsampson

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 avatar Jan 17 '20 00:01 atsampson

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

atsampson avatar Dec 24 '22 22:12 atsampson