mirror of
https://github.com/C4illin/ConvertX.git
synced 2026-03-03 02:17:01 +00:00
fix: add FFMPEG_OUTPUT_ARGS (#470)
This commit is contained in:
@@ -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 |
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user