Create parameter for new audio stream either before or after (#209)

* Create parameter for new audio stream either before or after 

parameter is empty; new stream will be created after the orginal.
parameter is 'before'; new stream is created before the existing stream

* Create parameter for new audio stream either before or after 

parameter is empty; new stream will be created after the orginal.
parameter is 'before'; new stream is created before the existing stream

* Bug fix

* Add dropdown

* Set after

* lint

* Lint fix

Co-authored-by: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com>
make-only-subtitle-default
michpas 4 years ago committed by GitHub
parent 06775a42a7
commit 0081942d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,8 +18,8 @@ const details = () => ({
type: 'text',
},
tooltip: 'Comma separated list of input codecs to be processed. Defaults to dts.'
+ '\\nExample:\\n'
+ 'dts,aac,ac3',
+ '\\nExample:\\n'
+ 'dts,aac,ac3',
}, {
name: 'output_codec',
type: 'string',
@ -28,6 +28,26 @@ const details = () => ({
type: 'text',
},
tooltip: 'FFMPEG encoder used for the output of the new tracks. Defaults to ac3.',
}, {
name: 'position_new_audio',
type: 'string',
defaultValue: '',
inputUI: {
type: 'text',
},
tooltip: 'postion new audiostream. empty equals post. enter word before to add the new track prior.',
}, {
name: 'position_new_audio',
type: 'string',
defaultValue: 'after',
inputUI: {
type: 'dropdown',
options: [
'before',
'after',
],
},
tooltip: 'Set the position of the new audio stream befor or after original',
}, {
name: 'bitrate',
type: 'string',
@ -44,7 +64,7 @@ const details = () => ({
type: 'text',
},
tooltip: '[true/false] Multi-channel audio requires a higher bitrate for the same quality, '
+ 'do you want the plugin to calculate this? (bitrate * (channels / 2))',
+ 'do you want the plugin to calculate this? (bitrate * (channels / 2))',
}, {
name: 'custom_bitrate_input',
type: 'string',
@ -95,7 +115,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
&& currStream.codec_name === inputs.output_codec
&& currStream.tags
) {
if (currStream.tags.COPYRIGHT === 'henk_asac') {
if (currStream.tags.COPYRIGHT === 'henk_asac' || currStream.tags.COPYRIGHT === '"henk_asac"') {
killPlugin = true;
}
}
@ -110,8 +130,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
const currStream = file.ffProbeData.streams[i];
if (currStream.codec_type.toLowerCase() === 'audio') {
response.preset += ` -map 0:a:${indexCount}? -c:a:${streamCount} copy `;
streamCount += 1;
if (inputs.position_new_audio === 'after') {
response.preset += ` -map 0:a:${indexCount}? -c:a:${streamCount} copy `;
streamCount += 1;
}
if (inputCodecs.includes(currStream.codec_name.toLowerCase())) {
convertCount += 1;
@ -128,6 +150,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
+ `-disposition:a:${streamCount} 0`;
streamCount += 1;
}
if (inputs.position_new_audio === 'before') {
response.preset += ` -map 0:a:${indexCount}? -c:a:${streamCount} copy `;
streamCount += 1;
}
indexCount += 1;
}
}

Loading…
Cancel
Save