1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 02:12:30 +01:00

fix crash

closes #2197
This commit is contained in:
Mikael Finstad 2024-10-22 14:39:46 +02:00
parent 6ddb3970f7
commit dedf301810
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
2 changed files with 9 additions and 4 deletions

View File

@ -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[]) {

View File

@ -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,
];