Skip to content

The swiss army knife of lossless video/audio editing

fix crash

Mikael Finstaddedf301810ad
diff --git a/src/main/ffmpeg.ts b/src/main/ffmpeg.ts
index 1dcc2cc5..8713b9ce 100644
--- a/src/main/ffmpeg.ts
+++ b/src/main/ffmpeg.ts
@@ -25,11 +25,12 @@ export function setCustomFfPath(path: string | undefined) {
}
function escapeCliArg(arg: string) {
+ // todo change String(arg) => arg when ts no-implicit-any is turned on
if (isWindows) {
// https://github.com/mifi/lossless-cut/issues/2151
- return /[\s"&<>^|]/.test(arg) ? `"${arg.replaceAll('"', '""')}"` : arg;
+ return /[\s"&<>^|]/.test(arg) ? `"${String(arg).replaceAll('"', '""')}"` : arg;
}
- return /[^\w-]/.test(arg) ? `'${arg.replaceAll("'", '\'"\'"\'')}'` : arg;
+ return /[^\w-]/.test(arg) ? `'${String(arg).replaceAll("'", '\'"\'"\'')}'` : arg;
}
export function getFfCommandLine(cmd: string, args: readonly string[]) {
diff --git a/src/renderer/src/hooks/useFfmpegOperations.ts b/src/renderer/src/hooks/useFfmpegOperations.ts
index 238669f7..7322cb7f 100644
--- a/src/renderer/src/hooks/useFfmpegOperations.ts
+++ b/src/renderer/src/hooks/useFfmpegOperations.ts
@@ -615,7 +615,11 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
// This is just used to load something into the player with correct duration,
// so that the user can seek and then we render frames using ffmpeg & MediaSource
- const html5ifyDummy = useCallback(async ({ filePath: filePathArg, outPath, onProgress }) => {
+ const html5ifyDummy = useCallback(async ({ filePath: filePathArg, outPath, onProgress }: {
+ filePath: string,
+ outPath: string,
+ onProgress: (p: number) => void,
+ }) => {
console.log('Making ffmpeg-assisted dummy file', { filePathArg, outPath });
const duration = await getDuration(filePathArg);
@@ -625,7 +629,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
// This is just a fast way of generating an empty dummy file
'-f', 'lavfi', '-i', 'anullsrc=channel_layout=stereo:sample_rate=44100',
- '-t', duration,
+ '-t', String(duration),
'-acodec', 'flac',
'-y', outPath,
];