fix: add FFMPEG_OUTPUT_ARGS (#470)

This commit is contained in:
Emrik Östling
2025-12-14 14:12:21 +01:00
committed by GitHub
parent 12a5580694
commit df3330fdc2
4 changed files with 8 additions and 4 deletions

View File

@@ -93,7 +93,8 @@ All are optional, JWT_SECRET is recommended to be set.
| ALLOW_UNAUTHENTICATED | false | Allow unauthenticated users to use the service, only set this to true locally |
| AUTO_DELETE_EVERY_N_HOURS | 24 | Checks every n hours for files older then n hours and deletes them, set to 0 to disable |
| WEBROOT | | The address to the root path setting this to "/convert" will serve the website on "example.com/convert/" |
| FFMPEG_ARGS | | Arguments to pass to ffmpeg, e.g. `-preset veryfast` |
| FFMPEG_ARGS | | Arguments to pass to the input file of ffmpeg, e.g. `-hwaccel vaapi` |
| FFMPEG_OUTPUT_ARGS | | Arguments to pass to the output of ffmpeg, e.g. `-preset veryfast` |
| HIDE_HISTORY | false | Hide the history page |
| LANGUAGE | en | Language to format date strings in, specified as a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) |
| UNAUTHENTICATED_USER_SHARING | false | Shares conversion history between all unauthenticated users |

View File

@@ -3,4 +3,4 @@ bun = "1.2.2"
[env]
JWT_SECRET = "JustForDevelopmentPurposesOnlyChangeMeInProduction!"
FFMPEG_ARGS = "-preset veryfast -threads 2"
FFMPEG_OUTPUT_ARGS = "-preset veryfast -threads 2"

View File

@@ -730,11 +730,14 @@ export async function convert(
// Parse FFMPEG_ARGS environment variable into array
const ffmpegArgs = process.env.FFMPEG_ARGS ? process.env.FFMPEG_ARGS.split(/\s+/) : [];
const ffmpegOutputArgs = process.env.FFMPEG_OUTPUT_ARGS
? process.env.FFMPEG_OUTPUT_ARGS.split(/\s+/)
: [];
return new Promise((resolve, reject) => {
execFile(
"ffmpeg",
["-i", filePath, ...ffmpegArgs, ...extraArgs, targetPath],
[...ffmpegArgs, "-i", filePath, ...ffmpegOutputArgs, ...extraArgs, targetPath],
(error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);

View File

@@ -135,7 +135,7 @@ test("respects FFMPEG_ARGS", async () => {
console.log = originalConsoleLog;
expect(calls[0]?.slice(2, 4)).toEqual(["-hide_banner", "-y"]);
expect(calls[0]?.slice(0, 2)).toEqual(["-hide_banner", "-y"]);
expect(loggedMessage).toBe("stdout: Fake stdout");
});