Speech to text module initially Video grep Mac OSX Electron app, by Sam Lavine @sam_lavigne
Then refactored as part of autoEdit, and subsequently as part of Digital Paper Edit app.
Pocketshphinx is set with American english dictionary.
git clone https://github.com/OpenNewsLabs/pocketsphinx-stt
cd pocketsphinx-stt
npm install
on npm pocketsphinx-stt
npm install pocketsphinx-stt
There are two options, one expect the file to be already an audio file that can work with pocketsphixn
const transcribe = require('pocketsphinx-stt').transcribe;
const videoFilePath = // some video file
transcribe(videoFilePath)
.then((res) => {
console.log('transcribe', res);
})
While the other will use ffmpeg convert the audio or video file to the right format for pocketsphinx.
const convertAndTranscribe = require('pocketsphinx-stt').convertAndTranscribe;
const videoFilePath = // some video file
convertAndTranscribe(videoFilePath)
.then((res) => {
console.log('transcribe', res);
})
It can take an optional parameter to specifiy where you'd want to save the audio file, if not provided it saves it in the same folder as the original media, with same name but audio extension.
Check out and try the example usage node src/example-usage.js
for more
Uses json format for transcript from Digital Paper Edit project.
{ words:
[ { text: 'why', start: 0.28, end: 1.23, accuracy: 0.018412, id: 0 },
{ text: 'not', start: 1.32, end: 1.85, accuracy: 0.851958, id: 1 },
{ text: 'she\'s', start: 2.4, end: 2.7, accuracy: 0.067643, id: 2 },
...
],
paragraphs:
[ { id: 0, start: 0.28, end: 3.93, speaker: 'U_UKN' },
{ id: 1, start: 4.69, end: 5.81, speaker: 'U_UKN' },
{ id: 2, start: 6.55, end: 7.37, speaker: 'U_UKN' },
...
]
}
TBC
- npm >
6.1.0
- Node 10 - dubnium
npm run build
packages via babel, in dist
folder
NA
On npm
npm run publish:public
Runs build and then publishes dist
folder to npm with copy of README
and package.json