@osaas/cli 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -30,6 +30,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
30
30
  const commander_1 = require("commander");
31
31
  const cmd_1 = __importDefault(require("./admin/cmd"));
32
32
  const cmdUser = __importStar(require("./user/cmd"));
33
+ const cmd_2 = __importDefault(require("./transcode/cmd"));
34
+ const cmd_3 = __importDefault(require("./vmaf/cmd"));
33
35
  const cli = new commander_1.Command();
34
36
  cli
35
37
  .configureHelp({ showGlobalOptions: true })
@@ -38,5 +40,7 @@ cli.addCommand((0, cmd_1.default)());
38
40
  cli.addCommand(cmdUser.cmdList());
39
41
  cli.addCommand(cmdUser.cmdCreate());
40
42
  cli.addCommand(cmdUser.cmdRemove());
43
+ cli.addCommand((0, cmd_2.default)());
44
+ cli.addCommand((0, cmd_3.default)());
41
45
  cli.parse(process.argv);
42
46
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,sDAAmC;AACnC,oDAAsC;AAEtC,MAAM,GAAG,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1B,GAAG;KACA,aAAa,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAC;AACvD,GAAG,CAAC,UAAU,CAAC,IAAA,aAAQ,GAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAClC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AACpC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AACpC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,sDAAmC;AACnC,oDAAsC;AACtC,0DAA2C;AAC3C,qDAAoC;AAEpC,MAAM,GAAG,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1B,GAAG;KACA,aAAa,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAC;AACvD,GAAG,CAAC,UAAU,CAAC,IAAA,aAAQ,GAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAClC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AACpC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AACpC,GAAG,CAAC,UAAU,CAAC,IAAA,aAAY,GAAE,CAAC,CAAC;AAC/B,GAAG,CAAC,UAAU,CAAC,IAAA,aAAU,GAAE,CAAC,CAAC;AAC7B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export default function cmdTranscode(): Command;
3
+ //# sourceMappingURL=cmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/transcode/cmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,UAAU,YAAY,YA2BnC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const client_core_1 = require("@osaas/client-core");
4
+ const client_transcode_1 = require("@osaas/client-transcode");
5
+ const commander_1 = require("commander");
6
+ function cmdTranscode() {
7
+ const transcode = new commander_1.Command('transcode');
8
+ transcode
9
+ .description('Transcode file to ABR fileset and store on S3 bucket')
10
+ .argument('<source>', 'Source URL (supported protocols: http, https)')
11
+ .argument('<dest>', 'Destination URL (supported protocols: s3)')
12
+ .option('-d, --duration <duration>', 'Duration in seconds. If not provided will transcode entire file')
13
+ .action(async (source, dest, options, command) => {
14
+ try {
15
+ const globalOpts = command.optsWithGlobals();
16
+ const environment = globalOpts?.env || 'prod';
17
+ const ctx = new client_core_1.Context({ environment });
18
+ const pool = new client_transcode_1.QueuePool({ context: ctx, size: 1 });
19
+ await pool.init();
20
+ await pool.transcode(new URL(source), new URL(dest), {
21
+ duration: options.duration
22
+ });
23
+ await pool.destroy();
24
+ }
25
+ catch (err) {
26
+ console.log(err.message);
27
+ }
28
+ });
29
+ return transcode;
30
+ }
31
+ exports.default = cmdTranscode;
32
+ //# sourceMappingURL=cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/transcode/cmd.ts"],"names":[],"mappings":";;AAAA,oDAA6C;AAC7C,8DAAoD;AACpD,yCAAoC;AAEpC,SAAwB,YAAY;IAClC,MAAM,SAAS,GAAG,IAAI,mBAAO,CAAC,WAAW,CAAC,CAAC;IAE3C,SAAS;SACN,WAAW,CAAC,sDAAsD,CAAC;SACnE,QAAQ,CAAC,UAAU,EAAE,+CAA+C,CAAC;SACrE,QAAQ,CAAC,QAAQ,EAAE,2CAA2C,CAAC;SAC/D,MAAM,CACL,2BAA2B,EAC3B,iEAAiE,CAClE;SACA,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAC/C,IAAI;YACF,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,WAAW,GAAG,UAAU,EAAE,GAAG,IAAI,MAAM,CAAC;YAC9C,MAAM,GAAG,GAAG,IAAI,qBAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YACzC,MAAM,IAAI,GAAG,IAAI,4BAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YACtD,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE;gBACnD,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;SACtB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IACL,OAAO,SAAS,CAAC;AACnB,CAAC;AA3BD,+BA2BC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export default function cmdCompare(): Command;
3
+ //# sourceMappingURL=cmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/vmaf/cmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,UAAU,UAAU,YAmCjC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const client_core_1 = require("@osaas/client-core");
4
+ const client_transcode_1 = require("@osaas/client-transcode");
5
+ const commander_1 = require("commander");
6
+ function cmdCompare() {
7
+ const compare = new commander_1.Command('compare');
8
+ compare
9
+ .command('vmaf')
10
+ .description('Compare two video files using VMAF')
11
+ .argument('<reference>', 'URL to reference video file (supported protocols: s3)')
12
+ .argument('<distorted>', 'URL to distorted video file (supported protocols: s3)')
13
+ .argument('<result>', 'URL where to store the result (supported protocols: s3)')
14
+ .action(async (reference, distorted, result, options, command) => {
15
+ try {
16
+ const globalOpts = command.optsWithGlobals();
17
+ const environment = globalOpts?.env || 'prod';
18
+ const ctx = new client_core_1.Context({ environment });
19
+ const resultUrl = await (0, client_transcode_1.vmafCompare)(ctx, new URL(reference), new URL(distorted), new URL(result));
20
+ (0, client_core_1.Log)().info(`VMAF comparison result stored at ${resultUrl.toString()}`);
21
+ }
22
+ catch (err) {
23
+ console.log(err.message);
24
+ }
25
+ });
26
+ return compare;
27
+ }
28
+ exports.default = cmdCompare;
29
+ //# sourceMappingURL=cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/vmaf/cmd.ts"],"names":[],"mappings":";;AAAA,oDAAkD;AAClD,8DAAsD;AACtD,yCAAoC;AAEpC,SAAwB,UAAU;IAChC,MAAM,OAAO,GAAG,IAAI,mBAAO,CAAC,SAAS,CAAC,CAAC;IAEvC,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oCAAoC,CAAC;SACjD,QAAQ,CACP,aAAa,EACb,uDAAuD,CACxD;SACA,QAAQ,CACP,aAAa,EACb,uDAAuD,CACxD;SACA,QAAQ,CACP,UAAU,EACV,yDAAyD,CAC1D;SACA,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAC/D,IAAI;YACF,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,WAAW,GAAG,UAAU,EAAE,GAAG,IAAI,MAAM,CAAC;YAC9C,MAAM,GAAG,GAAG,IAAI,qBAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YACzC,MAAM,SAAS,GAAG,MAAM,IAAA,8BAAW,EACjC,GAAG,EACH,IAAI,GAAG,CAAC,SAAS,CAAC,EAClB,IAAI,GAAG,CAAC,SAAS,CAAC,EAClB,IAAI,GAAG,CAAC,MAAM,CAAC,CAChB,CAAC;YACF,IAAA,iBAAG,GAAE,CAAC,IAAI,CAAC,oCAAoC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SACxE;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IACL,OAAO,OAAO,CAAC;AACjB,CAAC;AAnCD,6BAmCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osaas/cli",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Open Source Cloud CLI",
5
5
  "author": "Eyevinn Technology <work@eyevinn.se>",
6
6
  "homepage": "https://www.osaas.io",
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@osaas/client-core": "^0.5.0",
25
+ "@osaas/client-transcode": "^0.3.0",
25
26
  "chalk": "4.1.2",
26
27
  "commander": "^12.1.0",
27
28
  "fast-jwt": "^4.0.1"
@@ -29,5 +30,5 @@
29
30
  "publishConfig": {
30
31
  "access": "public"
31
32
  },
32
- "gitHead": "d6ac76ccd8ee1463c3484a67757271131b3ac5f2"
33
+ "gitHead": "b4832cc5efef3522a8797ee20b49a77c4f8384a9"
33
34
  }
package/readme.md CHANGED
@@ -28,7 +28,10 @@ Commands:
28
28
  list <serviceId> List all my service instances
29
29
  create [options] <serviceId> <name> Create a service instance
30
30
  remove <serviceId> <name> Remove a service instance
31
+ transcode [options] <source> <dest> Transcode file to ABR fileset and store on S3 bucket
32
+ compare
31
33
  help [command] display help for command
34
+
32
35
  ```
33
36
 
34
37
  To display help for subcommand `admin` you enter
@@ -74,6 +77,22 @@ Commands:
74
77
  % osc remove channel-engine clidemo
75
78
  ```
76
79
 
80
+ ### Create ABR files for VOD using SVT Encore
81
+
82
+ ```
83
+ osc transcode \
84
+ https://testcontent.eyevinn.technology/mp4/stswe-tvplus-promo.mp4 \
85
+ s3://lab-testcontent-store/birme/
86
+ ```
87
+
88
+ ### Compare two video files using VMAF
89
+
90
+ ```
91
+ % osc compare vmaf s3://lab-testcontent-store/birme/snaxax_x264_3100.mp4 \
92
+ s3://lab-testcontent-store/birme/snaxax_x264_324.mp4 \
93
+ s3://lab-testcontent-store/birme/
94
+ ```
95
+
77
96
  ### List all channel-engine instance for tenant `eyevinn` as an OSC super admin
78
97
 
79
98
  ```
package/src/cli.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  import { Command } from 'commander';
4
4
  import cmdAdmin from './admin/cmd';
5
5
  import * as cmdUser from './user/cmd';
6
+ import cmdTranscode from './transcode/cmd';
7
+ import cmdCompare from './vmaf/cmd';
6
8
 
7
9
  const cli = new Command();
8
10
 
@@ -13,4 +15,6 @@ cli.addCommand(cmdAdmin());
13
15
  cli.addCommand(cmdUser.cmdList());
14
16
  cli.addCommand(cmdUser.cmdCreate());
15
17
  cli.addCommand(cmdUser.cmdRemove());
18
+ cli.addCommand(cmdTranscode());
19
+ cli.addCommand(cmdCompare());
16
20
  cli.parse(process.argv);
@@ -0,0 +1,32 @@
1
+ import { Context } from '@osaas/client-core';
2
+ import { QueuePool } from '@osaas/client-transcode';
3
+ import { Command } from 'commander';
4
+
5
+ export default function cmdTranscode() {
6
+ const transcode = new Command('transcode');
7
+
8
+ transcode
9
+ .description('Transcode file to ABR fileset and store on S3 bucket')
10
+ .argument('<source>', 'Source URL (supported protocols: http, https)')
11
+ .argument('<dest>', 'Destination URL (supported protocols: s3)')
12
+ .option(
13
+ '-d, --duration <duration>',
14
+ 'Duration in seconds. If not provided will transcode entire file'
15
+ )
16
+ .action(async (source, dest, options, command) => {
17
+ try {
18
+ const globalOpts = command.optsWithGlobals();
19
+ const environment = globalOpts?.env || 'prod';
20
+ const ctx = new Context({ environment });
21
+ const pool = new QueuePool({ context: ctx, size: 1 });
22
+ await pool.init();
23
+ await pool.transcode(new URL(source), new URL(dest), {
24
+ duration: options.duration
25
+ });
26
+ await pool.destroy();
27
+ } catch (err) {
28
+ console.log((err as Error).message);
29
+ }
30
+ });
31
+ return transcode;
32
+ }
@@ -0,0 +1,40 @@
1
+ import { Context, Log } from '@osaas/client-core';
2
+ import { vmafCompare } from '@osaas/client-transcode';
3
+ import { Command } from 'commander';
4
+
5
+ export default function cmdCompare() {
6
+ const compare = new Command('compare');
7
+
8
+ compare
9
+ .command('vmaf')
10
+ .description('Compare two video files using VMAF')
11
+ .argument(
12
+ '<reference>',
13
+ 'URL to reference video file (supported protocols: s3)'
14
+ )
15
+ .argument(
16
+ '<distorted>',
17
+ 'URL to distorted video file (supported protocols: s3)'
18
+ )
19
+ .argument(
20
+ '<result>',
21
+ 'URL where to store the result (supported protocols: s3)'
22
+ )
23
+ .action(async (reference, distorted, result, options, command) => {
24
+ try {
25
+ const globalOpts = command.optsWithGlobals();
26
+ const environment = globalOpts?.env || 'prod';
27
+ const ctx = new Context({ environment });
28
+ const resultUrl = await vmafCompare(
29
+ ctx,
30
+ new URL(reference),
31
+ new URL(distorted),
32
+ new URL(result)
33
+ );
34
+ Log().info(`VMAF comparison result stored at ${resultUrl.toString()}`);
35
+ } catch (err) {
36
+ console.log((err as Error).message);
37
+ }
38
+ });
39
+ return compare;
40
+ }