Skip to content

Commit

Permalink
Adding filtering for HDR10+
Browse files Browse the repository at this point in the history
Realised haven't accounted for HDR10+ which would also likely be affected by ffmpeg so we skip those too.
Also some tidy up on comments
Removed a map cmd that shouldn't be needed
  • Loading branch information
Boosh1 committed Dec 17, 2024
1 parent 8324988 commit e84731c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Community/Tdarr_Plugin_bsh1_Boosh_FFMPEG_QSV_HEVC.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const details = () => ({
],
});

// Set up required variables.
// VARIABLES
let currentBitrate = 0;
let overallBitRate = 0;
let targetBitrate = 0;
Expand Down Expand Up @@ -412,6 +412,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
return response;
}

// FILE VIDEO BITRATE & DURATION
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
const strstreamType = file.ffProbeData.streams[i].codec_type.toLowerCase();
// Check if stream is a video.
Expand Down Expand Up @@ -464,6 +465,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
}
}

// CATCH BITRATE FAILURE OR SUCCESS
if (Number.isNaN(videoBR) || videoBR <= 0) {
// Work out currentBitrate using "Bitrate = file size / (number of minutes * .0075)"
currentBitrate = Math.round(file.file_size / (duration * 0.0075));
Expand Down Expand Up @@ -570,7 +572,6 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
// i.e drop mov_text for mkv files and drop pgs_subtitles for mp4
if (inputs.force_conform === true) {
if (inputs.container.toLowerCase() === 'mkv') {
extraArguments += '-map -0:d ';
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try {
if (
Expand Down Expand Up @@ -651,10 +652,12 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
} else {
// If specifically marked Dolby Vision
try {
if (file.mediaInfo.track[i + 1].HDR_Format.search('Dolby Vision') >= 0) {
response.infoLog += '==ERROR== This file has Media data implying it is Dolby Vision '
if (file.mediaInfo.track[i + 1].HDR_Format.search('Dolby Vision') >= 0
|| file.mediaInfo.track[i + 1].HDR_Format.search('HDR10+') >= 0
|| file.mediaInfo.track[i + 1].HDR_Format.search('SMPTE ST 2094 App 4') >= 0) {
response.infoLog += '==ERROR== This file has HDR metadata that cannot be re-encoded '
+ `(${file.mediaInfo.track[i + 1].HDR_Format}), `
+ 'Currently we cannot safely convert this HDR format and retain the Dolby Vision format. '
+ 'Currently we cannot safely convert this HDR format and retain the Dolby Vision or HDR10+ format. '
+ 'Aborting!\n';
return response;
}
Expand Down

0 comments on commit e84731c

Please sign in to comment.