Upload files to "/"

Initial Upload
This commit is contained in:
MNTLe 2024-03-02 18:37:08 +13:00
parent 73f4555d53
commit f23bc3d12f
3 changed files with 301 additions and 0 deletions

View File

@ -0,0 +1,99 @@
const details = () => ({
id: 'Tdarr_Plugin_0000_FFMPEG_NVENC_HEVC_Custom',
Stage: 'Pre-processing',
Name: 'FFMPEG NVENC HEVC Custom',
Type: 'Video',
Operation: 'Transcode',
Description:
'[Contains built-in filter] This plugin transcodes non HEVC files into HEVC mkv using ffmpeg and hevc_nvenc. Basic customization options have been provided. Generic HDR Passthrough is also included by default (may not work on all HDR videos). Audio/subtitles not affected. \n\n',
Version: '1.2',
Tags: 'pre-processing,ffmpeg,hevc,video only',
Inputs: [
{
name: 'cq',
type: 'string',
defaultValue: '22',
inputUI: {
type: 'dropdown',
options: ['0', '4', '8', '12', '14', '16', '18', '20', '22', '24', '26', '28', '30', '34', '38', '42', '50'],
},
tooltip: 'Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51)',
},
{
name: 'preset',
type: 'string',
defaultValue: 'p7',
inputUI: {
type: 'dropdown',
options: ['p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'hq', 'fast', 'medium', 'slow', 'lossless'],
},
tooltip: 'hevc_nvenc has nineteen predefined --preset options that optimize the trade-off between encoding speed (encoded frames per second) and compression efficiency (quality per bit in the bitstream). When you use faster presets, the encoder takes shortcuts to improve performance at the expense of quality and compression efficiency. When you use slower presets, nvenc_hevc tests more encoding options, using more computations to achieve the best quality at your selected bit rate. "p1" through "p7" are the standard fastest to slowest presets ("p7" being the slowest); "hq" is High Quality, and "slow" to "lossless" are self explanitory',
},
{
name: 'tune',
type: 'string',
defaultValue: 'hq',
inputUI: {
type: 'dropdown',
options: ['hq', 'll', 'ull', 'lossless'],
},
tooltip: '"hq" High quality. "ll" Low latency. "ull" Ultra low latency. "lossless" Lossless.',
},
{
name: 'profile',
type: 'string',
defaultValue: 'main10',
inputUI: {
type: 'dropdown',
options: ['main', 'main10', 'main12'],
},
tooltip: '"main" = 8bit; "main10" = 10bit; "main12" = 12bit encoding. Choose 10bit or higher to retain HDR content.',
},
],
});
const plugin = async (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
inputs = lib.loadDefaultValues(inputs, details);
const { cq, preset, tune, profile } = inputs;
const response = {
processFile: false,
preset: '',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: false,
infoLog: '',
};
if (file.fileMedium !== 'video') {
response.processFile = false;
response.infoLog += '☒File is not a video! \n';
return response;
}
response.infoLog += '☑File is a video! \n';
if (file.ffProbeData.streams[0].codec_name === 'av1') {
response.processFile = false;
response.infoLog += '☑File is already in AV1! \n';
return response;
}
response.processFile = true;
response.preset = `,-map 0:v -map 0:a -c:v:0 hevc_nvenc -preset ${preset} -tune ${tune} -profile:v ${profile} -cq:v ${cq} -rc:v vbr -rc-lookahead:v 8 -bf 3 \
-metadata:s:v:0 "chroma_location=topleft:color_primaries=bt2020:transfer_characteristics=smpte2084:color_trc=bt2020:colorspace=bt2020nc" \
-metadata:s:v:0 "master_display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(40000000,50)" \
-metadata:s:v:0 "max_cll=1600,300"`;
response.container = '.mkv';
response.handBrakeMode = false;
response.FFmpegMode = true;
response.reQueueAfter = true;
response.infoLog += '☒File is not AV1! \n';
return response;
};
module.exports.details = details;
module.exports.plugin = plugin;

View File

@ -0,0 +1,92 @@
const details = () => ({
id: 'Tdarr_Plugin_0000_FFMPEG_Opus_Custom',
Stage: 'Pre-processing',
Name: 'FFMPEG Opus Custom',
Type: 'Audio',
Operation: 'Transcode',
Description: '[Contains built-in filter] This plugin transcodes non Opus audio streams into Opus, giving you a basic bitrate control. Video/subtitles not affected. \n\n',
Version: '1.1',
Tags: 'pre-processing,ffmpeg,opus,audio only',
Inputs: [
{
name: 'bitrate',
type: 'string',
defaultValue: '128k',
inputUI: {
type: 'dropdown',
options: ['16k', '32k', '48k', '64k', '96k', '128k', '192k', '256k', '320k'],
},
tooltip: 'Select the audio bitrate to use for the Opus codec.',
},
{
name: 'maxchannels',
type: 'string',
defaultValue: 'Stereo',
inputUI: {
type: 'dropdown',
options: ['Mono', 'Stereo', '2.1', 'Quadrophonic', '5.1', '7.1'],
},
tooltip: 'Select the maximum number of channels to use for the Opus codec.',
},
],
});
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
inputs = lib.loadDefaultValues(inputs, details);
const bitrate = inputs.bitrate ?? '128k';
const channelMapping = {
Mono: 1,
Stereo: 2,
'2.1': 3,
Quadrophonic: 4,
'5.1': 6,
'7.1': 8,
};
const maxchannels = channelMapping[inputs.maxchannels ?? 'Stereo'];
const is5Point1Side =
file.ffProbeData.streams.some(
(s) =>
s.codec_type === 'audio' &&
s.channels === 6 &&
s.channel_layout === '5.1(side)'
);
// Workaround to force channel output to 6 if 5.1(side) detected
const adjustedChannels = is5Point1Side ? 6 : maxchannels;
const response = {
processFile: false,
preset: '',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: false,
infoLog: '',
};
if (file.fileMedium !== 'video') {
response.processFile = false;
response.infoLog += '☒File is not a video! \n';
return response;
}
response.infoLog += '☑File is a video! \n';
if (file.ffProbeData.streams.some((s) => s.codec_name === 'opus')) {
response.processFile = false;
response.infoLog += '☑File already has Opus audio codec! \n';
return response;
}
response.processFile = true;
response.preset = `,-map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:a libopus -ac ${adjustedChannels} -compression_level 10 -b:a ${bitrate} -application audio`;
response.handBrakeMode = false;
response.FFmpegMode = true;
response.reQueueAfter = true;
response.infoLog += '☒File does not have Opus codec! \n';
return response;
};
module.exports.details = details;
module.exports.plugin = plugin;

View File

@ -0,0 +1,110 @@
const details = () => ({
id: 'Tdarr_Plugin_0000_FFMPEG_SVT_AV1_Custom',
Stage: 'Pre-processing',
Name: 'FFMPEG SVT AV1 Custom',
Type: 'Video',
Operation: 'Transcode',
Description:
'[Contains built-in filter] This plugin transcodes non AV1 files into AV1 mkv using ffmpeg and svt-av1. Basic customization options have been provided. Generic HDR Passthrough is also included by default (may not work on all HDR videos). Audio/subtitles not affected. \n\n',
Version: '1.2',
Tags: 'pre-processing,ffmpeg,av1,video only',
Inputs: [
{
name: 'qp',
type: 'string',
defaultValue: '18',
inputUI: {
type: 'dropdown',
options: ['0', '4', '8', '12', '14', '16', '18', '20', '22', '24', '26', '28', '30', '34', '38', '42', '50'],
},
tooltip: 'Encoding Quality (higher decreases the file size at the expense of quality)',
},
{
name: 'preset',
type: 'string',
defaultValue: '10',
inputUI: {
type: 'dropdown',
options: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'],
},
tooltip: 'Presets control how many efficiency features are used during the encoding process, and the intensity with which those features are used. Lower presets use more features and produce a more efficient file (smaller file, for a given visual quality). However, lower presets also require more compute time during the encode process. If a file is to be widely distributed, it can be worth it to use very low presets, while high presets allow fast encoding, such as for real-time applications. Generally speaking, presets 1-3 represent extremely high efficiency, for use when encode time is not important and quality/size of the resulting video file is critical. Presets 4-6 are commonly used by home enthusiasts as they represent a balance of efficiency and reasonable compute time. Presets between 7 and 12 are used for fast and real-time encoding. Preset 13 is even faster but not intended for direct human consumption--it can be used, for example, as a per-scene quality metric in VOD applications. One should use the lowest preset that is tolerable.',
},
{
name: 'tile-rows',
type: 'string',
defaultValue: '4',
inputUI: {
type: 'dropdown',
options: ['1', '2', '3', '4', '8'],
},
tooltip: 'Number of tile rows',
},
{
name: 'tile-columns',
type: 'string',
defaultValue: '2',
inputUI: {
type: 'dropdown',
options: ['1', '2', '3', '4', '8'],
},
tooltip: 'Number of tile columns',
},
{
name: 'bit-depth',
type: 'string',
defaultValue: '8',
inputUI: {
type: 'dropdown',
options: ['8', '10'],
},
tooltip: 'Bit depth of the output video',
},
],
});
const plugin = async (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
inputs = lib.loadDefaultValues(inputs, details);
const { qp, preset, 'tile-rows': tileRows, 'tile-columns': tileColumns, 'bit-depth': bitDepth } = inputs;
const response = {
processFile: false,
preset: '',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: false,
infoLog: '',
};
if (file.fileMedium !== 'video') {
response.processFile = false;
response.infoLog += '☒File is not a video! \n';
return response;
}
response.infoLog += '☑File is a video! \n';
if (file.ffProbeData.streams[0].codec_name === 'av1') {
response.processFile = false;
response.infoLog += '☑File is already in AV1! \n';
return response;
}
response.processFile = true;
response.preset = `,-map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:v:0 libsvtav1 -qp ${qp} -preset ${preset} \
-tile_rows ${tileRows} -tile_columns ${tileColumns} -svtav1-params fast-decode=1:rc=0:aq-mode=2:undershoot-pct=100:overshoot-pct=0:enable-qm=1:bias-pct=100:film-grain=20:irefresh-type=2:enable-overlays=1:scd=1:scm=0:keyint=300:color-range=1:lookahead=-1:tune=0:input-depth=${bitDepth} \
-metadata:s:v:0 "chroma_location=topleft:color_primaries=bt2020:transfer_characteristics=smpte2084:color_trc=bt2020:colorspace=bt2020nc" \
-metadata:s:v:0 "master_display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(40000000,50)" \
-metadata:s:v:0 "max_cll=1600,300" \
-pix_fmt yuv420p${bitDepth === '8' ? '' : `${bitDepth}le`} -max_muxing_queue_size 9999`;
response.container = '.mkv';
response.handBrakeMode = false;
response.FFmpegMode = true;
response.reQueueAfter = true;
response.infoLog += '☒File is not AV1! \n';
return response;
};
module.exports.details = details;
module.exports.plugin = plugin;