Skip to content

Commit

Permalink
Improving the copy all audio option for mkv files
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Wooley authored and Travis Wooley committed Oct 21, 2023
1 parent 0deff81 commit aca1a13
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
}
if (file.video_resolution === '480p') {
actualHandbrakePreset = 'Gmail Medium 5 Minutes 480p30';
//actualHandbrakePreset = 'Gmail Small 10 Minutes 288p30';
// actualHandbrakePreset = 'Gmail Small 10 Minutes 288p30';
}
}
if (inputs.handbrakePreset === 'Vimeo YouTube HQ') {
Expand Down Expand Up @@ -267,7 +267,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
actualHandbrakePreset = 'Apple 2160p60 4K HEVC Surround';
}
if (file.video_resolution === '1080p') {
//actualHandbrakePreset = 'Apple 1080p60 Surround';
// actualHandbrakePreset = 'Apple 1080p60 Surround';
actualHandbrakePreset = 'Apple 1080p30 Surround';
}
if (file.video_resolution === '720p') {
Expand All @@ -292,7 +292,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|| file.video_resolution === '720p'
|| file.video_resolution === '576p'
|| file.video_resolution === '480p') {
//actualHandbrakePreset = 'Chromecast 1080p60 Surround';
// actualHandbrakePreset = 'Chromecast 1080p60 Surround';
actualHandbrakePreset = 'Chromecast 1080p30 Surround';
}
}
Expand Down Expand Up @@ -460,14 +460,24 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|| file.video_resolution === 'Other') {
actualHandbrakePreset = 'Production Proxy 1080p';
}
if (file.video_resolution === '576p' ||
file.video_resolution === '480p') {
if (file.video_resolution === '576p'
|| file.video_resolution === '480p') {
actualHandbrakePreset = 'Production Proxy 540p';
}
}

const keepSubs = inputs.keepSubtitles === true ? ' --all-subtitles' : '';
const keepAllAudio = inputs.keepAllAudio === true ? ' --all-audio' : '';
let keepAllAudio;
if (inputs.container === 'mkv') {
if (inputs.keepAllAudio === true) {
keepAllAudio = ' --all-audio --aencoder copy --audio-copy-mask aac,ac3,truehd,dts,dtshd,mp2,mp3,flac';
keepAllAudio += ' --audio-fallback ac3';
} else {
keepAllAudio = '';
}
} else {
keepAllAudio = inputs.keepAllAudio === true ? ' --all-audio' : '';
}

response.preset = `-Z "${actualHandbrakePreset}" -e ${inputs.videoEncoder}${keepSubs}${keepAllAudio}`;
response.container = `.${inputs.container}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ const tests = [
ffmpegMode: false,
},
},
{
input: {
file: require('../sampleData/media/sampleH264_1.json'),
librarySettings: {},
inputs: {
handbrakePreset: 'Fast',
videoEncoder: 'nvenc_h265',
keepSubtitles: 'true',
keepAllAudio: 'true',
container: 'mkv',
},
otherArguments: {},
},
output: {
processFile: true,
preset: '-Z "Fast 720p30" -e nvenc_h265 --all-subtitles --all-audio --aencoder copy --audio-copy-mask aac,ac3,truehd,dts,dtshd,mp2,mp3,flac --audio-fallback ac3',
container: '.mkv',
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: true,
infoLog: 'File is being transcoded using HandBrake \n',
handbrakeMode: true,
ffmpegMode: false,
},
},
{
input: {
file: require('../sampleData/media/sampleH264_1.json'),
Expand Down

0 comments on commit aca1a13

Please sign in to comment.