increase base transcoding quality

This commit is contained in:
SrGooglo 2023-08-15 18:44:39 +00:00
parent 7fcbedc8f4
commit dea1840439
2 changed files with 10 additions and 5 deletions

View File

@ -9,13 +9,13 @@ import videoTranscode from "@services/videoTranscode"
* @param {string} [options.videoCodec="libx264"] - The video codec to use.
* @param {string} [options.format="mp4"] - The format to use.
* @param {number} [options.audioBitrate=128] - The audio bitrate to use.
* @param {number} [options.videoBitrate=1024] - The video bitrate to use.
* @param {number} [options.videoBitrate=2024] - The video bitrate to use.
* @throws {Error} Throws an error if file parameter is not provided.
* @return {Object} The processed video file object.
*/
async function processVideo(
file,
options = {}
options = {},
) {
if (!file) {
throw new Error("file is required")
@ -26,14 +26,14 @@ async function processVideo(
videoCodec = "libx264",
format = "mp4",
audioBitrate = 128,
videoBitrate = 1024,
videoBitrate = 2024,
} = options
const result = await videoTranscode(file.filepath, file.cachePath, {
videoCodec,
format,
audioBitrate,
videoBitrate,
videoBitrate: [videoBitrate, true],
})
file.filepath = result.filepath

View File

@ -50,7 +50,12 @@ export default (input, cachePath, params = defaultParams) => {
console.warn(`[TRANSCODING] Method ${key} is not a function`)
return false
}
exec = exec[key](commands[key])
if (Array.isArray(commands[key])) {
exec = exec[key](...commands[key])
} else {
exec = exec[key](commands[key])
}
}
})