mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
update defaults
This commit is contained in:
parent
09c349f66e
commit
71eac66b1f
@ -7,7 +7,7 @@ const defaultParams = {
|
|||||||
videoBitrate: 1024,
|
videoBitrate: 1024,
|
||||||
videoCodec: "libvpx",
|
videoCodec: "libvpx",
|
||||||
audioCodec: "libvorbis",
|
audioCodec: "libvorbis",
|
||||||
format: "webm",
|
format: "mp4",
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxTasks = 5
|
const maxTasks = 5
|
||||||
@ -28,7 +28,9 @@ export default (input, params = defaultParams) => {
|
|||||||
console.debug(`[TRANSCODING] Transcoding ${input} to ${outputFilepath}`)
|
console.debug(`[TRANSCODING] Transcoding ${input} to ${outputFilepath}`)
|
||||||
|
|
||||||
const onEnd = async () => {
|
const onEnd = async () => {
|
||||||
console.debug(`[TRANSCODING] Finished transcode ${input} to ${outputFilepath}`)
|
console.debug(
|
||||||
|
`[TRANSCODING] Finished transcode ${input} to ${outputFilepath}`,
|
||||||
|
)
|
||||||
|
|
||||||
return resolve({
|
return resolve({
|
||||||
filename: outputFilename,
|
filename: outputFilename,
|
||||||
@ -37,7 +39,10 @@ export default (input, params = defaultParams) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onError = (err) => {
|
const onError = (err) => {
|
||||||
console.error(`[TRANSCODING] Transcoding ${input} to ${outputFilepath} failed`, err)
|
console.error(
|
||||||
|
`[TRANSCODING] Transcoding ${input} to ${outputFilepath} failed`,
|
||||||
|
err,
|
||||||
|
)
|
||||||
|
|
||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
@ -47,8 +52,8 @@ export default (input, params = defaultParams) => {
|
|||||||
const commands = {
|
const commands = {
|
||||||
input: input,
|
input: input,
|
||||||
...params,
|
...params,
|
||||||
preset: "ultrafast",
|
|
||||||
output: outputFilepath,
|
output: outputFilepath,
|
||||||
|
outputOptions: ["-preset veryfast"],
|
||||||
}
|
}
|
||||||
|
|
||||||
// chain methods
|
// chain methods
|
||||||
@ -66,6 +71,14 @@ export default (input, params = defaultParams) => {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key === "outputOptions" && Array.isArray(commands[key])) {
|
||||||
|
for (const option of commands[key]) {
|
||||||
|
exec = exec.outputOptions(option)
|
||||||
|
}
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof exec[key] !== "function") {
|
if (typeof exec[key] !== "function") {
|
||||||
console.warn(`[TRANSCODING] Method ${key} is not a function`)
|
console.warn(`[TRANSCODING] Method ${key} is not a function`)
|
||||||
return false
|
return false
|
||||||
@ -80,9 +93,6 @@ export default (input, params = defaultParams) => {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
exec
|
exec.on("error", onError).on("end", onEnd).run()
|
||||||
.on("error", onError)
|
|
||||||
.on("end", onEnd)
|
|
||||||
.run()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user