fix: ffmpeg args (#469)
This commit is contained in:
parent
eabd6e6a7f
commit
12a5580694
3 changed files with 5 additions and 4 deletions
|
|
@ -3,3 +3,4 @@ bun = "1.2.2"
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
JWT_SECRET = "JustForDevelopmentPurposesOnlyChangeMeInProduction!"
|
JWT_SECRET = "JustForDevelopmentPurposesOnlyChangeMeInProduction!"
|
||||||
|
FFMPEG_ARGS = "-preset veryfast -threads 2"
|
||||||
|
|
|
||||||
|
|
@ -699,7 +699,7 @@ export async function convert(
|
||||||
let message = "Done";
|
let message = "Done";
|
||||||
|
|
||||||
if (convertTo === "ico") {
|
if (convertTo === "ico") {
|
||||||
// make sure image is 256x256 or smaller
|
// Make sure image is 256x256 or smaller
|
||||||
extraArgs = [
|
extraArgs = [
|
||||||
"-filter:v",
|
"-filter:v",
|
||||||
"scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease",
|
"scale='min(256,iw)':min'(256,ih)':force_original_aspect_ratio=decrease",
|
||||||
|
|
@ -708,7 +708,7 @@ export async function convert(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (convertTo.split(".").length > 1) {
|
if (convertTo.split(".").length > 1) {
|
||||||
// support av1.mkv and av1.mp4 and h265.mp4 etc.
|
// Support av1.mkv and av1.mp4 and h265.mp4 etc.
|
||||||
const split = convertTo.split(".");
|
const split = convertTo.split(".");
|
||||||
const codec_short = split[0];
|
const codec_short = split[0];
|
||||||
|
|
||||||
|
|
@ -734,7 +734,7 @@ export async function convert(
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
execFile(
|
execFile(
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
[...ffmpegArgs, "-i", filePath, ...extraArgs, targetPath],
|
["-i", filePath, ...ffmpegArgs, ...extraArgs, targetPath],
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(`error: ${error}`);
|
reject(`error: ${error}`);
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ test("respects FFMPEG_ARGS", async () => {
|
||||||
|
|
||||||
console.log = originalConsoleLog;
|
console.log = originalConsoleLog;
|
||||||
|
|
||||||
expect(calls[0]?.slice(0, 2)).toEqual(["-hide_banner", "-y"]);
|
expect(calls[0]?.slice(2, 4)).toEqual(["-hide_banner", "-y"]);
|
||||||
expect(loggedMessage).toBe("stdout: Fake stdout");
|
expect(loggedMessage).toBe("stdout: Fake stdout");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue