{"_id":"@deepgram/captions","_rev":"11-8ebdf1330748714a21cf11e79060c6aa","name":"@deepgram/captions","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@deepgram/captions","version":"1.0.0","keywords":["audio","javascript","youtube","typescript","sdk","ffmpeg","speech","subtitles","srt","webvtt","speech-to-text","transcription","stt","asr","closed-captions","deepgram"],"author":{"name":"Deepgram DevRel Team","email":"devrel@deepgram.com"},"license":"MIT","_id":"@deepgram/captions@1.0.0","maintainers":[{"name":"deepgramai","email":"devrel@deepgram.com"}],"contributors":[{"url":"https://lukeocodes.dev","name":"Luke Oliff","email":"luke@lukeoliff.com"}],"homepage":"https://github.com/deepgram/deepgram-node-captions","bugs":{"url":"https://github.com/deepgram/deepgram-node-captions/issues"},"dist":{"shasum":"fc8afa73891d6380a02af6a36e815a3606680464","tarball":"https://registry.npmjs.org/@deepgram/captions/-/captions-1.0.0.tgz","fileCount":67,"integrity":"sha512-A0keO9HjdHhxFKLa0cks2Szf5kC3khZh/wNtrEsLvq2UuQIIgXhgjCpwKLJSnMiYxnewQNrMSfGr6qyrWMwGAQ==","signatures":[{"sig":"MEQCIFttpZbDTPJ98Xeq3/Z5Q6goKJwrrGnGCDW04cK1pDzoAiA8MkYUF3oMqwIQ1fIrg+19ASD2Z/j0953G4M4cX9t14A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67939},"main":"dist/main/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"pretty-quick --staged"}},"types":"dist/module/index.d.ts","unpkg":"dist/umd/deepgram-captions.js","module":"dist/module/index.js","engines":{"node":">=18.0.0"},"gitHead":"a31bd54d78347b7e6e29defc7f9cfc20fff54c5e","scripts":{"test":"mocha -r ts-node/register test/*test.ts test/**/*test.ts --insect --timeout 5000 || :","build":"run-s clean format build:*","clean":"rimraf dist","watch":"nodemon -e ts --watch src --exec \"npm run build\"","format":"prettier --write \"{src,test}/**/*.ts\"","build:umd":"webpack --mode=production","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","test:coverage":"nyc --reporter=lcovonly --reporter=text --reporter=text-summary npm run test"},"_npmUser":{"name":"deepgramai","email":"devrel@deepgram.com"},"jsdelivr":"dist/umd/deepgram-captions.js","repository":{"url":"git+https://github.com/deepgram/deepgram-node-captions.git","type":"git"},"_npmVersion":"9.8.1","description":"Node implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.3.7","dayjs":"^1.11.10","husky":"^4.3.0","mocha":"^9.2.2","rimraf":"^3.0.2","nodemon":"^3.0.1","ts-node":"^10.9.1","webpack":"^5.69.1","prettier":"^2.5.1","ts-loader":"^8.0.11","typescript":"^4.5.5","@types/chai":"^4.3.5","npm-run-all":"^4.1.5","webpack-cli":"^4.9.2","@types/mocha":"^9.1.1","pretty-quick":"^3.1.3","srt-validator":"^6.0.4","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^17.6.7","semantic-release-plugin-update-version-in-files":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/captions_1.0.0_1698486684960_0.6779967920175329","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@deepgram/captions","version":"1.1.0","keywords":["audio","javascript","youtube","typescript","sdk","ffmpeg","speech","subtitles","srt","webvtt","speech-to-text","transcription","stt","asr","closed-captions","deepgram"],"author":{"name":"Deepgram DevRel Team","email":"devrel@deepgram.com"},"license":"MIT","_id":"@deepgram/captions@1.1.0","maintainers":[{"name":"deepgramai","email":"devrel@deepgram.com"}],"contributors":[{"url":"https://lukeocodes.dev","name":"Luke Oliff","email":"luke@lukeoliff.com"}],"homepage":"https://github.com/deepgram/deepgram-node-captions","bugs":{"url":"https://github.com/deepgram/deepgram-node-captions/issues"},"dist":{"shasum":"6a07270139be52630b06aea4217c853f697771c1","tarball":"https://registry.npmjs.org/@deepgram/captions/-/captions-1.1.0.tgz","fileCount":76,"integrity":"sha512-wDZDcj7u3qUINWlubTD9cq9XGRjYTK251oHq8Cq0nbmu7ztZG4iT0qA/WxG0RIsqDlOw+aqAV5tQQCFXsAhS0A==","signatures":[{"sig":"MEYCIQCDEy+8BSA/+lzMA1AdBVcl4kQCrozijnETQm4H1J2aKwIhALwFyk2YrMwnzTHwUd85+o3HJDNo6ALrPX6aFSAH4WY9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79701},"main":"dist/main/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"pretty-quick --staged"}},"types":"dist/module/index.d.ts","unpkg":"dist/umd/deepgram-captions.js","module":"dist/module/index.js","engines":{"node":">=18.0.0"},"gitHead":"470e12cdb5179f26c6ce30dde0fe6b78e66c47cf","scripts":{"test":"mocha -r ts-node/register test/*test.ts test/**/*test.ts --insect --timeout 5000 || :","build":"run-s clean format build:*","clean":"rimraf dist","watch":"nodemon -e ts --watch src --exec \"npm run build\"","format":"prettier --write \"{src,test}/**/*.ts\"","build:umd":"webpack --mode=production","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","test:coverage":"nyc --reporter=lcovonly --reporter=text --reporter=text-summary npm run test"},"_npmUser":{"name":"deepgramai","email":"devrel@deepgram.com"},"jsdelivr":"dist/umd/deepgram-captions.js","repository":{"url":"git+https://github.com/deepgram/deepgram-node-captions.git","type":"git"},"_npmVersion":"9.8.1","description":"Node implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.3.7","dayjs":"^1.11.10","husky":"^4.3.0","mocha":"^9.2.2","rimraf":"^3.0.2","nodemon":"^3.0.1","ts-node":"^10.9.1","webpack":"^5.69.1","prettier":"^2.5.1","ts-loader":"^8.0.11","typescript":"^4.5.5","@types/chai":"^4.3.5","npm-run-all":"^4.1.5","webpack-cli":"^4.9.2","@types/mocha":"^9.1.1","pretty-quick":"^3.1.3","srt-validator":"^6.0.4","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^17.6.7","semantic-release-plugin-update-version-in-files":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/captions_1.1.0_1698746239926_0.014253677552473976","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@deepgram/captions","version":"1.1.1","keywords":["audio","javascript","youtube","typescript","sdk","ffmpeg","speech","subtitles","srt","webvtt","speech-to-text","transcription","stt","asr","closed-captions","deepgram"],"author":{"name":"Deepgram DevRel Team","email":"devrel@deepgram.com"},"license":"MIT","_id":"@deepgram/captions@1.1.1","maintainers":[{"name":"deepgramai","email":"devrel@deepgram.com"}],"contributors":[{"url":"https://lukeocodes.dev","name":"Luke Oliff","email":"luke@lukeoliff.com"}],"homepage":"https://github.com/deepgram/deepgram-node-captions","bugs":{"url":"https://github.com/deepgram/deepgram-node-captions/issues"},"dist":{"shasum":"6ea452fe80ce7b03683d2b48be0707f82e07a6e4","tarball":"https://registry.npmjs.org/@deepgram/captions/-/captions-1.1.1.tgz","fileCount":76,"integrity":"sha512-hQ3UoV/VBrCYn11MpYo7uYaswjW8pvHDUbhiXBpiTkddp0Ojn1QmxzmWSYRCm/6vs/2aTS0gOG0ZlR2pLHx/UQ==","signatures":[{"sig":"MEUCIQDKPenAdsJ0giv+o+5kYYClrRx0WggE9U/OnQ6VaYs6VwIgQO3STpZLfH38z5GeWHqzAVYGjArmG1N8P3MA27qiZ+M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79731},"main":"dist/main/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"pretty-quick --staged"}},"types":"dist/module/index.d.ts","unpkg":"dist/umd/deepgram-captions.js","module":"dist/module/index.js","engines":{"node":">=18.0.0"},"gitHead":"1b341612d3e7c7264ec97e3464e16e0172984a35","scripts":{"test":"mocha -r ts-node/register test/*test.ts test/**/*test.ts --insect --timeout 5000 || :","build":"run-s clean format build:*","clean":"rimraf dist","watch":"nodemon -e ts --watch src --exec \"npm run build\"","format":"prettier --write \"{src,test}/**/*.ts\"","build:umd":"webpack --mode=production","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","test:coverage":"nyc --reporter=lcovonly --reporter=text --reporter=text-summary npm run test"},"_npmUser":{"name":"deepgramai","email":"devrel@deepgram.com"},"jsdelivr":"dist/umd/deepgram-captions.js","repository":{"url":"git+https://github.com/deepgram/deepgram-node-captions.git","type":"git"},"_npmVersion":"9.8.1","description":"Node implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"dayjs":"^1.11.10"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.3.7","husky":"^4.3.0","mocha":"^9.2.2","rimraf":"^3.0.2","nodemon":"^3.0.1","ts-node":"^10.9.1","webpack":"^5.69.1","prettier":"^2.5.1","ts-loader":"^8.0.11","typescript":"^4.5.5","@types/chai":"^4.3.5","npm-run-all":"^4.1.5","webpack-cli":"^4.9.2","@types/mocha":"^9.1.1","pretty-quick":"^3.1.3","srt-validator":"^6.0.4","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^17.6.7","semantic-release-plugin-update-version-in-files":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/captions_1.1.1_1699093951638_0.4377607007846782","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@deepgram/captions","version":"1.2.0","keywords":["audio","javascript","youtube","typescript","sdk","ffmpeg","speech","subtitles","srt","webvtt","speech-to-text","transcription","stt","asr","closed-captions","deepgram"],"author":{"name":"Deepgram DevRel Team","email":"devrel@deepgram.com"},"license":"MIT","_id":"@deepgram/captions@1.2.0","maintainers":[{"name":"deepgramai","email":"devrel@deepgram.com"}],"contributors":[{"url":"https://lukeocodes.dev","name":"Luke Oliff","email":"luke@lukeoliff.com"}],"homepage":"https://github.com/deepgram/deepgram-node-captions","bugs":{"url":"https://github.com/deepgram/deepgram-node-captions/issues"},"dist":{"shasum":"e3d33b494692a4a3c3f81568d8386894c0fc5d9a","tarball":"https://registry.npmjs.org/@deepgram/captions/-/captions-1.2.0.tgz","fileCount":76,"integrity":"sha512-8B1C/oTxTxyHlSFubAhNRgCbQ2SQ5wwvtlByn8sDYZvdDtdn/VE2yEPZ4BvUnrKWmsbTQY6/ooLV+9Ka2qmDSQ==","signatures":[{"sig":"MEUCIQDxV1KHB3etY/SFOkIO0BhNp/9G31CcqI7oQnIPGt90GgIgR2VCXfvZLKncTdlrb/zBkRQmrA6JMGdo0SEwIxklKEo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86067},"main":"dist/main/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"pretty-quick --staged"}},"types":"dist/module/index.d.ts","unpkg":"dist/umd/deepgram-captions.js","module":"dist/module/index.js","engines":{"node":">=18.0.0"},"gitHead":"2c23c6bbb04d533568fe58beb3b2b11012eab503","scripts":{"test":"mocha -r ts-node/register test/*test.ts test/**/*test.ts --insect --timeout 5000 || :","build":"run-s clean format build:*","clean":"rimraf dist","watch":"nodemon -e ts --watch src --exec \"npm run build\"","format":"prettier --write \"{src,test}/**/*.ts\"","build:umd":"webpack --mode=production","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","test:coverage":"nyc --reporter=lcovonly --reporter=text --reporter=text-summary npm run test"},"_npmUser":{"name":"deepgramai","email":"devrel@deepgram.com"},"jsdelivr":"dist/umd/deepgram-captions.js","repository":{"url":"git+https://github.com/deepgram/deepgram-node-captions.git","type":"git"},"_npmVersion":"9.8.1","description":"Node implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"dayjs":"^1.11.10"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.3.7","husky":"^4.3.0","mocha":"^9.2.2","rimraf":"^3.0.2","nodemon":"^3.0.1","ts-node":"^10.9.1","webpack":"^5.69.1","prettier":"^2.5.1","ts-loader":"^8.0.11","typescript":"^4.5.5","@types/chai":"^4.3.5","npm-run-all":"^4.1.5","webpack-cli":"^4.9.2","@types/mocha":"^9.1.1","pretty-quick":"^3.1.3","srt-validator":"^6.0.4","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^17.6.7","semantic-release-plugin-update-version-in-files":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/captions_1.2.0_1699345820284_0.15375226016774235","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-10-28T09:51:24.959Z","modified":"2026-09-11T09:54:14.467Z","1.0.0":"2023-10-28T09:51:25.204Z","1.1.0":"2023-10-31T09:57:20.147Z","1.1.1":"2023-11-04T10:32:31.817Z","1.2.0":"2023-11-07T08:30:20.464Z"},"bugs":{"url":"https://github.com/deepgram/deepgram-node-captions/issues"},"author":{"name":"Deepgram DevRel Team","email":"devrel@deepgram.com"},"license":"MIT","homepage":"https://github.com/deepgram/deepgram-node-captions","keywords":["audio","javascript","youtube","typescript","sdk","ffmpeg","speech","subtitles","srt","webvtt","speech-to-text","transcription","stt","asr","closed-captions","deepgram"],"repository":{"url":"git+https://github.com/deepgram/deepgram-node-captions.git","type":"git"},"description":"Node implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.","contributors":[{"url":"https://lukeocodes.dev","name":"Luke Oliff","email":"luke@lukeoliff.com"}],"maintainers":[{"email":"devrel@deepgram.com","name":"deepgramai"},{"email":"greg.holmes@deepgram.com","name":"greg.holmes"},{"email":"kiley.williams@deepgram.com","name":"deepgram-kiley"}],"readme":"# Deepgram Captions\n\nThis package is the JavaScript implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.\n\n> Works with ANY transcription format.\n\n## Installation\n\n```bash\nnpm install @deepgram/captions\n# - or -\n# yarn add @deepgram/captions\n```\n\n## WebVTT from Deepgram Transcriptions\n\n```ts\nimport { webvtt } from \"@deepgram/captions\";\n\nconst result = webvtt(deepgram_transcription_result);\n```\n\n## SRT from Deepgram Transcriptions\n\n```ts\nimport { srt } from \"@deepgram/captions\";\n\nconst result = srt(deepgram_transcription_result);\n```\n\n## Converters\n\nThis package has been built to convert any transcription format. You only need to provide a `converter` class to provide the formatters with the correct data.\n\n### Example Converter\n\nA generic converter would look like this:\n\n```ts\nimport { chunkArray, WordBase, IConverter } from \"@deepgram/captions\";\n\nexport class GenericConverter implements IConverter {\n  constructor(public transcriptionData: any) {}\n\n  getLines(lineLength: number = 8): WordBase[][] {\n    const results = this.transcriptionData;\n    let content: WordBase[][] = [];\n\n    results.paragraphs.forEach((paragraph) => {\n      if (paragraph.words.length > lineLength) {\n        content.push(...chunkArray(paragraph.words, lineLength));\n      } else {\n        content.push(paragraph.words);\n      }\n    });\n\n    return content;\n  }\n}\n```\n\nIt requires that `getLines` return the following data structure:\n\n```ts\n// const transcriptionData: WordBase[][] = [\nconst transcriptionData = [\n  [\n    {\n      word: string;\n      start: number;\n      end: number;\n      punctuated_word: string; // optional\n    }\n  ]\n]\n```\n\nUsing your converter will look like this:\n\n```ts\nimport { srt } from \"@deepgram/captions\";\n\nconst result = srt(new GenericConverter(transcription_result));\n```\n\n### Included Converters\n\n#### Assembly AI\n\n```ts\nimport { webvtt, AssemblyAiConverter } from \"@deepgram/captions\";\n\nconst result = webvtt(new AssemblyAiConverter(assembly_result));\n```\n\n## Output WebVTT\n\nWhen transcribing https://dpgr.am/spacewalk.wav, and running it through our library, this is the WebVTT output.\n\n```ts\nimport { webvtt } from \"@deepgram/captions\";\n\nconst result = webvtt(deepgram_transcription_result);\n\nconsole.log(result);\n```\n\nThis is the result:\n\n```text\nWEBVTT\n\nNOTE\nTranscription provided by Deepgram\nRequest Id: 686278aa-d315-4aeb-b2a9-713615544366\nCreated: 2023-10-27T15:35:56.637Z\nDuration: 25.933313\nChannels: 1\n\n00:00:00.080 --> 00:00:03.220\nYeah. As as much as, it's worth celebrating,\n\n00:00:04.400 --> 00:00:05.779\nthe first, spacewalk,\n\n00:00:06.319 --> 00:00:07.859\nwith an all female team,\n\n00:00:08.475 --> 00:00:10.715\nI think many of us are looking forward\n\n00:00:10.715 --> 00:00:13.215\nto it just being normal and\n\n00:00:13.835 --> 00:00:16.480\nI think if it signifies anything, It is\n\n00:00:16.779 --> 00:00:18.700\nto honor the the women who came before\n\n00:00:18.700 --> 00:00:21.680\nus who, were skilled and qualified,\n\n00:00:22.300 --> 00:00:24.779\nand didn't get the same opportunities that we\n\n00:00:24.779 --> 00:00:25.439\nhave today.\n```\n\n## Output SRT\n\nWhen transcribing https://dpgr.am/spacewalk.wav, and running it through our library, this is the SRT output.\n\n```ts\nimport { srt } from \"@deepgram/captions\";\n\nconst result = srt(deepgram_transcription_result);\n\nconsole.log(result);\n```\n\nThis is the result:\n\n```text\n1\n00:00:00,080 --> 00:00:03,220\nYeah. As as much as, it's worth celebrating,\n\n2\n00:00:04,400 --> 00:00:07,859\nthe first, spacewalk, with an all female team,\n\n3\n00:00:08,475 --> 00:00:10,715\nI think many of us are looking forward\n\n4\n00:00:10,715 --> 00:00:14,235\nto it just being normal and I think\n\n5\n00:00:14,235 --> 00:00:17,340\nif it signifies anything, It is to honor\n\n6\n00:00:17,340 --> 00:00:19,820\nthe the women who came before us who,\n\n7\n00:00:20,140 --> 00:00:23,580\nwere skilled and qualified, and didn't get the\n\n8\n00:00:23,580 --> 00:00:25,439\nsame opportunities that we have today.\n```\n\n## Documentation\n\nYou can learn more about the Deepgram API at [developers.deepgram.com](https://developers.deepgram.com/docs).\n\n## Development and Contributing\n\nInterested in contributing? We ❤️ pull requests!\n\nTo make sure our community is safe for all, be sure to review and agree to our\n[Code of Conduct](./.github/CODE_OF_CONDUCT.md). Then see the\n[Contribution](./.github/CONTRIBUTING.md) guidelines for more information.\n\n## Getting Help\n\nWe love to hear from you so if you have questions, comments or find a bug in the\nproject, let us know! You can either:\n\n- [Open an issue in this repository](https://github.com/deepgram/[reponame]/issues/new)\n- [Join the Deepgram Github Discussions Community](https://github.com/orgs/deepgram/discussions)\n- [Join the Deepgram Discord Community](https://discord.gg/xWRaCDBtW4)\n\n[license]: LICENSE.txt\n","readmeFilename":"README.md"}