mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 15:38:19 -07:00
Update
This commit is contained in:
parent
b04bfdb085
commit
53c3c5c799
1 changed files with 75 additions and 31 deletions
|
|
@ -9,7 +9,7 @@ function details() {
|
|||
Type: "Video",
|
||||
Description: `If the file is not in h265 it will be trancoded into h265 with HandBrake using the following command '-e x265 -q 22 --encoder-preset slow --all-audio --all-subtitles copy:aac -E fdk_aac -Q 4 -x aq-mode=3'. If no aac, aac track will be added. Subtitles are kept. Metadata is removed.\n\n
|
||||
`,
|
||||
Version: "1.00",
|
||||
Version: "1.01",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta"
|
||||
}
|
||||
|
||||
|
|
@ -22,13 +22,13 @@ function plugin(file) {
|
|||
|
||||
var response = {
|
||||
|
||||
processFile : false,
|
||||
preset : '',
|
||||
container : '.mp4',
|
||||
handBrakeMode : false,
|
||||
FFmpegMode : false,
|
||||
reQueueAfter : false,
|
||||
infoLog : '',
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -43,42 +43,86 @@ function plugin(file) {
|
|||
|
||||
return response
|
||||
|
||||
} else {
|
||||
|
||||
var jsonString = JSON.stringify(file)
|
||||
} else {
|
||||
|
||||
|
||||
if(file.ffProbeData.streams[0].codec_name != 'hevc'){
|
||||
if(file.ffProbeData.streams[0].codec_name != 'hevc'){
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = '-e x265 -q 22 --encoder-preset slow --all-audio --all-subtitles copy:aac -E fdk_aac -Q 4 -x aq-mode=3'
|
||||
response.container = '.mkv'
|
||||
response.handBrakeMode =true
|
||||
response.FFmpegMode = false
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += "☒File is not in hevc! \n"
|
||||
return response
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File is already in hevc! \n"
|
||||
}
|
||||
response.processFile = true;
|
||||
response.preset = ', -map 0 -c copy -c:v:0 libx265 -preset:v slow -pix_fmt yuv420p10le -x265-params "crf=22:aq-mode=3"'
|
||||
response.container = '.mkv'
|
||||
response.FFmpegMode = true
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += "☒File is not in hevc! \n"
|
||||
return response
|
||||
|
||||
}else{
|
||||
response.infoLog += "☑File is already in hevc! \n"
|
||||
}
|
||||
|
||||
|
||||
if(file.meta.Title != undefined ){
|
||||
|
||||
|
||||
|
||||
var audioIdx = -1
|
||||
var ffmpegCommandInsert = ''
|
||||
var hasnonAACTrack = false
|
||||
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
|
||||
try {
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
|
||||
audioIdx++
|
||||
}
|
||||
} catch (err) { }
|
||||
|
||||
|
||||
try {
|
||||
if (file.ffProbeData.streams[i].codec_name !== 'aac' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) {
|
||||
ffmpegCommandInsert += ` -c:a:${audioIdx} aac -vbr 4 `
|
||||
hasnonAACTrack = true
|
||||
|
||||
}
|
||||
} catch (err) { }
|
||||
|
||||
}
|
||||
|
||||
var ffmpegCommand = `,-map 0 -c:v copy -c:a copy ${ffmpegCommandInsert} -c:s copy -c:d copy`
|
||||
|
||||
if (hasnonAACTrack == true) {
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = ffmpegCommand
|
||||
response.container = '.mkv'
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += "☒ File has audio which is not in aac! \n"
|
||||
return response
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
response.infoLog += "☑ All audio streams are in aac! \n"
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (file.meta.Title != undefined) {
|
||||
|
||||
response.infoLog += "☒File has title metadata \n"
|
||||
response.preset = ',-map_metadata -1 -c:v copy -c:a copy'
|
||||
response.preset = ',-metadata title="" -metadata comment="" -map 0 -c copy'
|
||||
response.container = '.mkv'
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
response.FFmpegMode = true
|
||||
return response
|
||||
}else{
|
||||
} else {
|
||||
response.infoLog += "☑File has no title metadata \n"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
response.infoLog += "☑File meets conditions! \n"
|
||||
return response
|
||||
response.infoLog += "☑File meets conditions! \n"
|
||||
return response
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue