This is a proof-of-concept repository that converts transcribed captions generated by Web Captioner into other languages using the Google Scripts API.
To use this script, you need to prepare NodeJS, Web Captioner, and a Google Script Project.
- Open https://script.google.com/ and create a new project
- Delete all text and paste the following code into the new script:
// This script receives the text to be translated, the original language and the destination language // It calls google translator and returns the translated text. // As found on https://github.com/tanabee/google-translation-api/blob/master/code.js function doGet(e) { var p = e.parameter; var translatedText = LanguageApp.translate(p.text, p.source, p.target); return ContentService.createTextOutput(translatedText); }
- Save the project
- Select Deploy, then New deployment and create a Web App
- Save the Deployment ID, it will be used later
Make sure you have a reasonably recent version of node and npm installed. To install all dependencies, run:
npm install
Set up your configuration options (deployment ID, source and target languages) in index.js
.
To start the server, run:
npm start
You can then access the generated page at http://address:3000/index.html
. This page provides a transparent
background, allowing easy integration with OBS Studio and other broadcasting software.
In webcaptioner.com, go to the Settings into the Channels option, and enable a Webhook. Configure the webhook with the following options:
- URL:
http://address:3000/hook
- Chunking: A suitable number of words for each subtitle. A number between 10-30 should work depending on the content.
After having configured all of the above, subtitles should start updating at:
http://address:3000/
- OBS-live-translation, which was an inspiration for this project