This commit is contained in:
Manav Rathi 2024-04-30 10:51:20 +05:30
parent 761fd560a1
commit a5177a3742
No known key found for this signature in database

View file

@ -104,11 +104,21 @@ export const extractVideoMetadata = async (
const outputData =
uploadItem instanceof File
? await ffmpegExecWeb(command, uploadItem, "txt", 0)
: await electron.ffmpegExec(command, uploadItem, "txt", 0);
: await electron.ffmpegExec(command, forE(uploadItem), "txt", 0);
return parseFFmpegExtractedMetadata(outputData);
};
/**
* For each of cases of {@link UploadItem} that apply when we're running in the
* context of our desktop app, return a value that can be passed to
* {@link Electron}'s {@link ffmpegExec} over IPC.
*/
const forE = (desktopUploadItem: Exclude<UploadItem, File>) =>
typeof desktopUploadItem == "string" || Array.isArray(desktopUploadItem)
? desktopUploadItem
: desktopUploadItem.path;
// Options:
//
// - `-c [short for codex] copy`