mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 01:36:08 -07:00
Adjust gpu inputs
This commit is contained in:
parent
d8a86dc6d5
commit
599ae068a4
1 changed files with 15 additions and 3 deletions
|
|
@ -25,7 +25,19 @@ const details = () => ({
|
||||||
tooltip: 'Specify the codec to use',
|
tooltip: 'Specify the codec to use',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'use_gpu',
|
name: 'target_bitrate_multiplier',
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 0.5,
|
||||||
|
inputUI: {
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
tooltip: `
|
||||||
|
Specify the multiplier to use to calculate the target bitrate.
|
||||||
|
Default of 0.5 will roughly half the size of the file.
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'try_use_gpu',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
inputUI: {
|
inputUI: {
|
||||||
|
|
@ -180,7 +192,7 @@ const getEncoder = async ({
|
||||||
otherArguments,
|
otherArguments,
|
||||||
}) => {
|
}) => {
|
||||||
let { encoder } = inputs;
|
let { encoder } = inputs;
|
||||||
if (inputs.use_gpu && (inputs.encoder === 'hevc' || inputs.encoder === 'h264')) {
|
if (inputs.try_use_gpu && (inputs.encoder === 'hevc' || inputs.encoder === 'h264')) {
|
||||||
const gpuEncoders = [
|
const gpuEncoders = [
|
||||||
{
|
{
|
||||||
encoder: 'hevc_nvenc',
|
encoder: 'hevc_nvenc',
|
||||||
|
|
@ -293,7 +305,7 @@ const plugin = async (file, librarySettings, inputs, otherArguments) => {
|
||||||
// Use the same calculation used for currentBitrate but divide it in half to get targetBitrate.
|
// Use the same calculation used for currentBitrate but divide it in half to get targetBitrate.
|
||||||
// Logic of h265 can be half the bitrate as h264 without losing quality.
|
// Logic of h265 can be half the bitrate as h264 without losing quality.
|
||||||
|
|
||||||
const targetBitrate = currentBitrate / 2;
|
const targetBitrate = currentBitrate * inputs.target_bitrate_multiplier;
|
||||||
// Allow some leeway under and over the targetBitrate.
|
// Allow some leeway under and over the targetBitrate.
|
||||||
|
|
||||||
const minimumBitrate = (targetBitrate * 0.7);
|
const minimumBitrate = (targetBitrate * 0.7);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue