tweak video processing

This commit is contained in:
SrGooglo 2025-02-05 02:49:22 +00:00
parent 288846ff99
commit 582c7e389b

View File

@ -13,10 +13,7 @@ import videoTranscode from "@services/videoTranscode"
* @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, options = {}) {
file,
options = {},
) {
if (!file) { if (!file) {
throw new Error("file is required") throw new Error("file is required")
} }
@ -26,7 +23,7 @@ async function processVideo(
videoCodec = "libx264", videoCodec = "libx264",
format = "mp4", format = "mp4",
audioBitrate = 128, audioBitrate = 128,
videoBitrate = 2024, videoBitrate = 3000,
} = options } = options
const result = await videoTranscode(file.filepath, { const result = await videoTranscode(file.filepath, {
@ -34,9 +31,7 @@ async function processVideo(
format, format,
audioBitrate, audioBitrate,
videoBitrate: [videoBitrate, true], videoBitrate: [videoBitrate, true],
extraOptions: [ extraOptions: ["-threads 2"],
"-threads 1"
]
}) })
file.filepath = result.filepath file.filepath = result.filepath