Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-transcode

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-transcode - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0-beta.0

2

package.json
{
"name": "aws-transcode",
"version": "1.0.0",
"version": "1.1.0-beta.0",
"description": "A promise based wrapper to make transcoding with AWS easy.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -17,3 +17,3 @@ # aws-transcode

const transcode = require('aws-transcode');
const key = 'input/video.mp4';
const input = 'input/video.mp4';
const outputs = [

@@ -38,3 +38,3 @@ {

const res = await transcode(key, outputs, config);
const res = await transcode(input, outputs, config);

@@ -49,2 +49,11 @@ if (res === false) {

### Extracting a part of the input file.
The `input` can also be an object with a `key` (required) and `start`, `duration` values (optional).
```js
const input = { key: 'input/video.mp4', start: 5, duration: 10 };
const res = await transcode(input, outputs, config);
```
## License

@@ -51,0 +60,0 @@

@@ -29,3 +29,6 @@ const abind = require('abind');

*
* @param {string} key
* @param {object} input
* {string} key input key
* {number} start optional defaults to 0
* {number} duration optional defaults to duration of input file
* @param {object[]} outputs an array of outputs { key, presetId, thumbnailPattern }

@@ -39,7 +42,7 @@ * {string} key output key (bucket is defined in the pipeline)

*/
async transcode (key, outputs) {
async transcode (input, outputs) {
const filteredOutputs = await this.maybeRemoveExistingOutputs(outputs);
if (!filteredOutputs.length) return false;
const jobId = await this.createTranscoderJob(key, filteredOutputs);
return this.waitForTranscoderJob(key, jobId);
const jobId = await this.createTranscoderJob(input, filteredOutputs);
return this.waitForTranscoderJob(input.key, jobId);
}

@@ -86,6 +89,15 @@

*/
async createTranscoderJob (key, outputs) {
async createTranscoderJob (input, outputs) {
const { key, start = 0, duration } = input;
const { pipelineId } = this.config;
const params = {
Input: { Key: key },
Input: {
Key: key,
...((start > 0 || duration) && {
TimeSpan: {
...(start > 0 && { StartTime: Number(start).toFixed(3) }),
...(duration && { Duration: Number(duration).toFixed(3) })
}
})
},
PipelineId: pipelineId,

@@ -152,7 +164,10 @@ Outputs: outputs.map(({ key, presetId, thumbnailPattern }) => ({

async function transcode (key, outputs, config) {
async function transcode (input, outputs, config) {
if (typeof input === 'string') {
input = { key: input };
}
const transcoder = new AwsTranscoder(config);
return transcoder.transcode(key, outputs);
return transcoder.transcode(input, outputs);
}
module.exports = transcode;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc