mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 15:38:19 -07:00
New
This commit is contained in:
parent
270f35004b
commit
1620b32fc2
4 changed files with 568 additions and 0 deletions
195
Community/Tdarr_Plugin_075a_Transcode_Customisable.js
Normal file
195
Community/Tdarr_Plugin_075a_Transcode_Customisable.js
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
|
||||
|
||||
|
||||
module.exports.details = function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_075a_Transcode_Customisable",
|
||||
Stage: "Pre-processing",
|
||||
Name: "Transcode Customisable",
|
||||
Type: "",
|
||||
Operation: "Transcode",
|
||||
Description: `[TESTING][Contains built-in filter] Specify codec filter and transcode arguments for HandBrake or FFmpeg \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "",
|
||||
Inputs: [
|
||||
{
|
||||
name: 'codecs_to_exclude',
|
||||
tooltip: `Input codecs, separated by a comma, that should be excluded when processing.
|
||||
|
||||
\\nFor example, if you're transcoding into hevc (h265), then add a filter to prevent hevc being transcoded so your newly transcoded files won't be infinitely looped/processed. \\n
|
||||
|
||||
\\nExample:\\n
|
||||
|
||||
hevc
|
||||
|
||||
\\nYou can also enter multiple codecs:
|
||||
|
||||
\\nExample:\\n
|
||||
|
||||
mp3,aac,dts
|
||||
|
||||
\\nExample:\\n
|
||||
|
||||
h264,vp9
|
||||
|
||||
`
|
||||
},
|
||||
{
|
||||
name: 'cli',
|
||||
tooltip: `Enter the CLI to use.
|
||||
|
||||
\\nExample:\\n
|
||||
handbrake
|
||||
|
||||
\\nExample:\\n
|
||||
ffmpeg
|
||||
|
||||
`
|
||||
},
|
||||
{
|
||||
name: 'transcode_arguments',
|
||||
tooltip: `\\nEnter HandBrake or FFmpeg transcode arguments.
|
||||
|
||||
\\nHandBrake examples:
|
||||
|
||||
\\nExample:\\n
|
||||
-e x264 -q 20 -B
|
||||
|
||||
\\nExample:\\n
|
||||
-Z "Very Fast 1080p30"
|
||||
|
||||
\\nExample:\\n
|
||||
-Z "Fast 1080p30" -e nvenc_h265
|
||||
|
||||
\\nExample:\\n
|
||||
-Z "Very Fast 1080p30" --all-subtitles --all-audio
|
||||
|
||||
\\nExample:\\n
|
||||
-Z "Very Fast 480p30"
|
||||
|
||||
\\nExample:\\n
|
||||
--preset-import-file "C:\Users\HaveAGitGat\Desktop\testpreset.json" -Z "My Preset"
|
||||
|
||||
\\nYou can learn more about HandBrake presets here:
|
||||
|
||||
\\nhttps://handbrake.fr/docs/en/latest/technical/official-presets.html
|
||||
|
||||
|
||||
\\nWhen using FFmpeg, you need to separate the input and output parameters with a comma. FFmpeg Examples:
|
||||
|
||||
\\nExample:\\n
|
||||
-r 1,-r 24
|
||||
|
||||
\\nExample:\\n
|
||||
,-sn -c:v copy -c:a copy
|
||||
|
||||
\\nExample:\\n
|
||||
,-c:v lib265 -crf 23 -ac 6 -c:a aac -preset veryfast
|
||||
|
||||
\\nExample:\\n
|
||||
,-map 0 -c copy -c:v libx265 -c:a aac
|
||||
|
||||
\\nExample:\\n
|
||||
-c:v h264_cuvid,-c:v hevc_nvenc -preset slow -c:a copy
|
||||
|
||||
\\nPlease see the following for help with creating FFmpeg commands:
|
||||
|
||||
\\nhttps://opensource.com/article/17/6/ffmpeg-convert-media-file-formats
|
||||
|
||||
|
||||
|
||||
|
||||
`
|
||||
},
|
||||
{
|
||||
name: 'output_container',
|
||||
tooltip: `
|
||||
\\nEnter the output container of the new file
|
||||
|
||||
\\nExample:\\n
|
||||
.mp4
|
||||
|
||||
\\nExample:\\n
|
||||
.mp3
|
||||
|
||||
\\nExample:\\n
|
||||
.mkv
|
||||
|
||||
`
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
||||
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
|
||||
if (inputs.codecs_to_exclude === undefined
|
||||
|| inputs.cli === undefined
|
||||
|| inputs.transcode_arguments === undefined
|
||||
|| inputs.output_container === undefined) {
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ Inputs not entered! \n"
|
||||
return response
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (inputs.codecs_to_exclude.includes(file.ffProbeData.streams[0].codec_name)) {
|
||||
response.processFile = false
|
||||
response.infoLog += `☑File is already in ${file.ffProbeData.streams[0].codec_name}! \n`
|
||||
return response
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//transcode settings
|
||||
|
||||
if (inputs.cli == `handbrake`) {
|
||||
response.handBrakeMode = true
|
||||
response.FFmpegMode = false
|
||||
} else if (inputs.cli == `ffmpeg`) {
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
|
||||
} else {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒ CLI not input correctly! \n"
|
||||
return response
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = inputs.transcode_arguments
|
||||
response.container = inputs.output_container
|
||||
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += `☒File is not in desired codec! \n`
|
||||
return response
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue