Skip to content

Commit

Permalink
Apply auto-build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HaveAGitGat authored and github-actions[bot] committed Jun 21, 2024
1 parent 9ce8ec2 commit a9f367a
Showing 1 changed file with 71 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ var details = function () { return ({
},
tooltip: 'Specify codec of the output file',
},
{
label: 'Enable FFmpeg Preset',
name: 'ffmpegPresetEnabled',
type: 'boolean',
defaultValue: 'true',
inputUI: {
type: 'switch',
},
tooltip: 'Specify whether to use an FFmpeg preset',
},
{
label: 'FFmpeg Preset',
name: 'ffmpegPreset',
Expand All @@ -88,16 +98,56 @@ var details = function () { return ({
'superfast',
'ultrafast',
],
displayConditions: {
logic: 'AND',
sets: [
{
logic: 'AND',
inputs: [
{
name: 'ffmpegPresetEnabled',
value: 'true',
condition: '===',
},
],
},
],
},
},
tooltip: 'Specify ffmpeg preset',
},
{
label: 'Enable FFmpeg CRF',
name: 'ffmpegQualityEnabled',
type: 'boolean',
defaultValue: 'true',
inputUI: {
type: 'switch',
},
tooltip: 'Specify whether to set crf (or qp for GPU encoding)',
},
{
label: 'FFmpeg Quality',
name: 'ffmpegQuality',
type: 'number',
defaultValue: '25',
inputUI: {
type: 'text',
displayConditions: {
logic: 'AND',
sets: [
{
logic: 'AND',
inputs: [
{
name: 'ffmpegQualityEnabled',
value: 'true',
condition: '===',
},
],
},
],
},
},
tooltip: 'Specify ffmpeg quality',
},
Expand Down Expand Up @@ -159,10 +209,10 @@ var details = function () { return ({
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
var lib, hardwareDecoding, hardwareType, i, stream, targetCodec, ffmpegPreset, ffmpegQuality, forceEncoding, hardwarEncoding, encoderProperties;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var lib, hardwareDecoding, hardwareType, i, stream, targetCodec, _a, ffmpegPresetEnabled, ffmpegQualityEnabled, ffmpegPreset, ffmpegQuality, forceEncoding, hardwarEncoding, encoderProperties;
var _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
lib = require('../../../../../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
Expand All @@ -171,12 +221,13 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
hardwareType = String(args.inputs.hardwareType);
args.variables.ffmpegCommand.hardwareDecoding = hardwareDecoding;
i = 0;
_c.label = 1;
_d.label = 1;
case 1:
if (!(i < args.variables.ffmpegCommand.streams.length)) return [3 /*break*/, 4];
stream = args.variables.ffmpegCommand.streams[i];
if (!(stream.codec_type === 'video')) return [3 /*break*/, 3];
targetCodec = String(args.inputs.outputCodec);
_a = args.inputs, ffmpegPresetEnabled = _a.ffmpegPresetEnabled, ffmpegQualityEnabled = _a.ffmpegQualityEnabled;
ffmpegPreset = String(args.inputs.ffmpegPreset);
ffmpegQuality = String(args.inputs.ffmpegQuality);
forceEncoding = args.inputs.forceEncoding === true;
Expand All @@ -191,24 +242,28 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
args: args,
})];
case 2:
encoderProperties = _c.sent();
encoderProperties = _d.sent();
stream.outputArgs.push('-c:{outputIndex}', encoderProperties.encoder);
if (encoderProperties.isGpu) {
stream.outputArgs.push('-qp', ffmpegQuality);
}
else {
stream.outputArgs.push('-crf', ffmpegQuality);
if (ffmpegQualityEnabled) {
if (encoderProperties.isGpu) {
stream.outputArgs.push('-qp', ffmpegQuality);
}
else {
stream.outputArgs.push('-crf', ffmpegQuality);
}
}
if (targetCodec !== 'av1' && ffmpegPreset) {
stream.outputArgs.push('-preset', ffmpegPreset);
if (ffmpegPresetEnabled) {
if (targetCodec !== 'av1' && ffmpegPreset) {
stream.outputArgs.push('-preset', ffmpegPreset);
}
}
if (hardwareDecoding) {
(_a = stream.inputArgs).push.apply(_a, encoderProperties.inputArgs);
(_b = stream.inputArgs).push.apply(_b, encoderProperties.inputArgs);
}
if (encoderProperties.outputArgs) {
(_b = stream.outputArgs).push.apply(_b, encoderProperties.outputArgs);
(_c = stream.outputArgs).push.apply(_c, encoderProperties.outputArgs);
}
_c.label = 3;
_d.label = 3;
case 3:
i += 1;
return [3 /*break*/, 1];
Expand Down

0 comments on commit a9f367a

Please sign in to comment.