amazon-translate-subtitles
!npm packagenpm-imgnpm-url
!Build Statusbuild-imgbuild-url
!Downloadsdownloads-imgdownloads-url
!Issuesissues-imgissues-url
!Code Coveragecodecov-imgcodecov-url
!Commitizen Friendlycommitizen-imgcommitizen-url
!Semantic Releasesemantic-release-imgsemantic-release-urlTranslate subtitles embedded in video files using Amazon Translate
Currently supports mkv input and srt output.
Install
npm install amazon-translate-subtitles
Usage
import { translateSubtitles } from 'amazon-translate-subtitles';
const video = createReadStream('my-video.mkv');
const thaiSubs = await translateSubtitles({ video, targetLanguage: 'th' });
console.log(thaiSubs);
/*
"
1
00:00:03,549 --> 00:00:05,290
... ยักษ์ใหญ่แห่งโรดส์!
2
00:00:05,757 --> 00:00:06,678
ไม่!
"
*/
API
translateSubtitles(options)
options
Type:object
awsClientOverrides
Type:object
Default:
{}
Configuration options passed to the AWS SDK Translate client as overrides.
showProgress
Type:boolean
Default:
false
Turns the progress bar on or off.
sourceLanguage
Type:string
Default:
'en'
Source language for translating the subtitles from.
sourceTrackType
Type:string
Default:
'auto'
Source track type to select if multiple subtitle tracks of the same language are available. Options are
auto
, sdh
, and forced
.Auto: The library will attempt to grab the standard subtitles.
SDH: Subtitles designed for those who are deaf and hard of hearing.
Forced: Displayed when the video has a secondary language being spoken.
targetLanguage
Type:string
Target language for translating the subtitles to.
video
Type:ReadStream
Read Stream of the video file you would like to translate subtitles for.
Related
- amazon-translate-subtitles-clicli-url - CLI for this module