Merge pull request #110 from tmchow/patch-2

Add config option for audio transcode bitrate
This commit is contained in:
HaveAGitGat 2020-11-14 04:08:25 +01:00 committed by GitHub
commit a71f5e28ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,6 +34,16 @@ module.exports.details = function details() {
\\nExample:\\n \\nExample:\\n
eac3 eac3
`,
},
{
name: "bitrate",
tooltip: `Specify the transcoded audio bitrate (optional):
\\n 384k
\\n 640k
\\nExample:\\n
640k
`, `,
}, },
], ],
@ -53,7 +63,7 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
infoLog: "", infoLog: "",
}; };
if (inputs.codecs_to_transcode === undefined || inputs.codec === undefined) { if (inputs.codecs_to_transcode === undefined || inputs.codec === undefined ) {
response.processFile = false; response.processFile = false;
response.infoLog += "☒ Inputs not entered! \n"; response.infoLog += "☒ Inputs not entered! \n";
return response; return response;
@ -81,6 +91,9 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
) )
) { ) {
ffmpegCommand += ` -map 0:${i} -c:${i} ${encoder} `; ffmpegCommand += ` -map 0:${i} -c:${i} ${encoder} `;
if (inputs.bitrate != undefined) {
ffmpegCommand += `-b:a ${inputs.bitrate} `;
}
hasStreamsToTranscode = true; hasStreamsToTranscode = true;
} else if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { } else if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
ffmpegCommand += ` -map 0:${i}`; ffmpegCommand += ` -map 0:${i}`;