mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
increase base transcoding quality
This commit is contained in:
parent
7fcbedc8f4
commit
dea1840439
@ -9,13 +9,13 @@ import videoTranscode from "@services/videoTranscode"
|
|||||||
* @param {string} [options.videoCodec="libx264"] - The video codec to use.
|
* @param {string} [options.videoCodec="libx264"] - The video codec to use.
|
||||||
* @param {string} [options.format="mp4"] - The format to use.
|
* @param {string} [options.format="mp4"] - The format to use.
|
||||||
* @param {number} [options.audioBitrate=128] - The audio bitrate 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.
|
* @throws {Error} Throws an error if file parameter is not provided.
|
||||||
* @return {Object} The processed video file object.
|
* @return {Object} The processed video file object.
|
||||||
*/
|
*/
|
||||||
async function processVideo(
|
async function processVideo(
|
||||||
file,
|
file,
|
||||||
options = {}
|
options = {},
|
||||||
) {
|
) {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
throw new Error("file is required")
|
throw new Error("file is required")
|
||||||
@ -26,14 +26,14 @@ async function processVideo(
|
|||||||
videoCodec = "libx264",
|
videoCodec = "libx264",
|
||||||
format = "mp4",
|
format = "mp4",
|
||||||
audioBitrate = 128,
|
audioBitrate = 128,
|
||||||
videoBitrate = 1024,
|
videoBitrate = 2024,
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
const result = await videoTranscode(file.filepath, file.cachePath, {
|
const result = await videoTranscode(file.filepath, file.cachePath, {
|
||||||
videoCodec,
|
videoCodec,
|
||||||
format,
|
format,
|
||||||
audioBitrate,
|
audioBitrate,
|
||||||
videoBitrate,
|
videoBitrate: [videoBitrate, true],
|
||||||
})
|
})
|
||||||
|
|
||||||
file.filepath = result.filepath
|
file.filepath = result.filepath
|
||||||
|
@ -50,7 +50,12 @@ export default (input, cachePath, params = defaultParams) => {
|
|||||||
console.warn(`[TRANSCODING] Method ${key} is not a function`)
|
console.warn(`[TRANSCODING] Method ${key} is not a function`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
exec = exec[key](commands[key])
|
|
||||||
|
if (Array.isArray(commands[key])) {
|
||||||
|
exec = exec[key](...commands[key])
|
||||||
|
} else {
|
||||||
|
exec = exec[key](commands[key])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user