You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
74 lines
2.2 KiB
"use strict";
|
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.plugin = exports.details = void 0;
|
|
/* eslint-disable no-param-reassign */
|
|
var details = function () { return ({
|
|
name: 'Set Video Encoder',
|
|
description: 'Set the video encoder for all streams',
|
|
style: {
|
|
borderColor: '#6efefc',
|
|
},
|
|
tags: 'video',
|
|
isStartPlugin: false,
|
|
sidebarPosition: -1,
|
|
icon: '',
|
|
inputs: [
|
|
{
|
|
name: 'targetCodec',
|
|
type: 'string',
|
|
defaultValue: 'hevc',
|
|
inputUI: {
|
|
type: 'dropdown',
|
|
options: [
|
|
'hevc',
|
|
// 'vp9',
|
|
'h264',
|
|
// 'vp8',
|
|
],
|
|
},
|
|
tooltip: 'Specify the codec to use',
|
|
},
|
|
{
|
|
name: 'forceEncoding',
|
|
type: 'boolean',
|
|
defaultValue: 'false',
|
|
inputUI: {
|
|
type: 'dropdown',
|
|
options: [
|
|
'false',
|
|
'true',
|
|
],
|
|
},
|
|
tooltip: 'Specify whether to force encoding if stream already has the target codec',
|
|
},
|
|
],
|
|
outputs: [
|
|
{
|
|
number: 1,
|
|
tooltip: 'Continue to next plugin',
|
|
},
|
|
],
|
|
}); };
|
|
exports.details = details;
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
var plugin = function (args) {
|
|
var lib = require('../../../../../methods/lib')();
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
|
// @ts-expect-error type
|
|
args.variables.ffmpegCommand.streams.forEach(function (stream) {
|
|
if (stream.codec_type === 'video') {
|
|
// @ts-expect-error type
|
|
stream.targetCodec = args.inputs.targetCodec;
|
|
stream.forceEncoding = args.inputs.forceEncoding;
|
|
}
|
|
});
|
|
return {
|
|
outputFileObj: args.inputFileObj,
|
|
outputNumber: 1,
|
|
variables: args.variables,
|
|
};
|
|
};
|
|
exports.plugin = plugin;
|