{"id":18377042,"url":"https://github.com/bbc/subtitles-generator","last_synced_at":"2025-04-06T20:32:09.071Z","repository":{"id":136960849,"uuid":"189402053","full_name":"bbc/subtitles-generator","owner":"bbc","description":"A node module to generate subtitles by segmenting a list of time-coded text - BBC News Labs","archived":false,"fork":false,"pushed_at":"2023-07-08T13:36:25.000Z","size":633,"stargazers_count":49,"open_issues_count":9,"forks_count":7,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-22T06:51:17.698Z","etag":null,"topics":["captions","digital-paper-edit","itt","json","news-labs","newslabs","premiere","srt","stt","subtitles","transcript-editor","ttml","vtt"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-30T11:30:57.000Z","updated_at":"2025-01-28T16:01:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"004f249e-0ccd-43a7-b6c8-7c36cb84a4d5","html_url":"https://github.com/bbc/subtitles-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fsubtitles-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fsubtitles-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fsubtitles-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fsubtitles-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbc","download_url":"https://codeload.github.com/bbc/subtitles-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247547980,"owners_count":20956649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["captions","digital-paper-edit","itt","json","news-labs","newslabs","premiere","srt","stt","subtitles","transcript-editor","ttml","vtt"],"created_at":"2024-11-06T00:26:00.920Z","updated_at":"2025-04-06T20:32:09.064Z","avatar_url":"https://github.com/bbc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Subtitles Generator - draft \n\nA node module to generate subtitles by segmenting a list of time-coded text.\n\nExports to \n- [x] TTML for Premiere as `.xml`\n- [x] TTML \n- [x] iTT - for Apple \n- [x] srt\n- [x] vtt \n- [x] csv \n- [x] txt - pre-segmented text\n\nIt can also provide pre-segmented lines if the input is plain text.\n\n## Setup\n\u003c!-- _stack - optional_\n_How to build and run the code/app_ --\u003e\n\ngit clone, cd into folder, `npm install`\n\n\n## Usage\n\n```js\nconst subtitlesComposer = require('./src/index.js');\n// const sampleWords = // some word json \nconst subtitlesJson = subtitlesComposer({words: sampleWords, type: 'json'})\nconst ttmlPremiere = subtitlesComposer({words: sampleWords, type: 'premiere'})\nconst ittData = subtitlesComposer({words: sampleWords, type: 'itt'})\nconst ttmlData = subtitlesComposer({words: sampleWords, type: 'ttml'})\nconst srtData = subtitlesComposer({words: sampleWords, type: 'srt'})\nconst vttData = subtitlesComposer({words: sampleWords, type: 'vtt'})\n```\nsee [`example-usage.js`](./example-usage.js) for more comprehensive example.\n\nTo try locally\n```\nnpx babel-node example-usage.js\n```\n\n### `words` Input \n- either an array list of words objects    \nexample\n```js\nconst sampleWords =[ \n      {\n        \"id\": 0,\n        \"start\": 13.02,\n        \"end\": 13.17,\n        \"text\": \"There\"\n      },\n      {\n        \"id\": 1,\n        \"start\": 13.17,\n        \"end\": 13.38,\n        \"text\": \"is\"\n      },\n      {\n        \"id\": 2,\n        \"start\": 13.38,\n        \"end\": 13.44,\n        \"text\": \"a\"\n      },\n      {\n        \"id\": 3,\n        \"start\": 13.44,\n        \"end\": 13.86,\n        \"text\": \"day.\"\n      },\n...\n```\n- or a string of text     \nExample\n```js\nconst sampleWords = \"There is a day. ...\"\n```\n\nIf input `words` is plain text only (and not a list of words with timecodes) then can only use `pre-segment-txt` option. (see [`test-presegment.txt`](./example-output/test-presegment.txt) for example)\n\n## Output: \nsee [`example-output`](./example-output) folder for examples.\n\n\n## System Architecture\n\u003c!-- _High level overview of system architecture_ --\u003e\n\nIn pseudo code, at a high level \n```\n// expecting array list of words OR plain text string\n\n  // if array list of words, convert text into string\n\n  // presegment the text \n     using pre segmentation algorithm to break into line of x char - default 35\n\n// generate subtitles \n   use subtitles generators for various format to convert presegemented json into subtitles\n\n// return trsult\n```\n\nSegmentation algorithm refactored from [`pietrop/subtitlesComposer`](https://github.com/pietrop/subtitlesComposer) originally by [@polizoto](https://github.com/polizoto). \nAnd subtitles generation in various originally format by [`@laurian`](https://github.com/laurian) and [`@maboa`](https://github.com/maboa)as part of BBC Subtitlelizer project.\n\n## Development env\n \u003c!-- _How to run the development environment_\n_Coding style convention ref optional, eg which linter to use_\n_Linting, github pre-push hook - optional_ --\u003e\n\n- npm \u003e `6.1.0`\n- [Node 10 - dubnium](https://scotch.io/tutorials/whats-new-in-node-10-dubnium)\n- [Eslint](https://eslint.org/)\n- [Babel](https://babeljs.io/)\n\nNode version is set in node version manager [`.nvmrc`](https://github.com/creationix/nvm#nvmrc)\n\n## Build\n\u003c!-- _How to run build_ --\u003e\n\n```\nnpm run build\n```\n\nuses [babel-cli](https://babeljs.io/docs/en/babel-cli) to transpile ES6 into the `./build` folder.\n\n\n## Tests\n\u003c!-- _How to carry out tests_ --\u003e\n\n```\nnpm test\n```\n\nTo run tests during development\n\n```\nnpm run test:watch\n```\n\n## Linting\nTo run linter\n\n```\nnpm run lint\n```\n\nTo run and fix\n```\nnpm run lint:fix\n```\n\n## Deployment\n\u003c!-- _How to deploy the code/app into test/staging/production_ --\u003e\n\n_coming soon, deploying to npm registry as [@bbc/subtitles-composer]()_\n\n```\nnpm run publish:public\n```\n\n---\n\n# TODO\n- [ ] Open source\n- [x] use import/export in modules \n- [x] add babel \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Fsubtitles-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbc%2Fsubtitles-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Fsubtitles-generator/lists"}