Open Peter200lx opened 1 year ago
This is a different request from https://github.com/abb128/LiveCaptions/issues/70 as I'm not wanting to change the workflow of captioning itself, I just want a text file or API for exporting the generated text live to other programs.
Writing to a text file is the easiest way to do that. I know the OBS text element supports reloading the whole file, or "chat log" mode which tails the file and follows it like the tail -f
command. That would only be of use once an entire line has completed though.
It would probably be better to have some very basic plugin system rather than try to support OBS' protocol. You see this kind of thing elsewhere with bridges that translate Open Sound Control from control panels in to OBS.
I have no idea if the maintainers have an interest in such a plugin system. Or how that could work with Flatpak, since that complicates file access a bit. The easiest way would be to just point at a file on the system, fork+exec it, and speak OSC or JSON over stdin/stdout. Though such a plugin being run by a Flatpak program would belong to the same sandbox and the user would have to use Flatseal to allow internet access (which I think is already granted to download the model but still.)
(I do lament how the text control has regressed in utility. It used to be decently powerful like supporting text justification and most of that has been removed.)
I added a basic implementation of this in the main branch. There is now a toggle in settings to enable D-Bus text stream. This will start emitting the plain text as the TextStream signal in the D-Bus interface.
For example, you can monitor it with this command:
dbus-monitor "type='signal',interface='net.sapples.LiveCaptions.External',path='/net/sapples/LiveCaptions/External',member='TextStream'"
There is also a property TextStreamActive that tells you if the setting is on or not.
It should be possible to use this to write a Python script or something that streams to OBS or any other application. There's also this you can look into - https://github.com/grillo-delmal/obs-catpion
It would be really nice if a live feed of text could be written to a text file, or otherwise exported to other programs. Specifically asking because I'd love to have OBS be able to provide a live feed of closed caption text when streaming. I don't know the details right off but the OBS websocket protocol does have an API for sending captions. https://github.com/obsproject/obs-websocket/blob/release/5.0.0/docs/generated/protocol.md#sendstreamcaption . If supporting a specific API is too narrow of a focus for this program then if it can live write to a text file I could manage the sending of captions to OBS with a separate program.