mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-24 19:32:29 +01:00
parent
6ddb3970f7
commit
dedf301810
@ -25,11 +25,12 @@ export function setCustomFfPath(path: string | undefined) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function escapeCliArg(arg: string) {
|
function escapeCliArg(arg: string) {
|
||||||
|
// todo change String(arg) => arg when ts no-implicit-any is turned on
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
// https://github.com/mifi/lossless-cut/issues/2151
|
// 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[]) {
|
export function getFfCommandLine(cmd: string, args: readonly string[]) {
|
||||||
|
@ -615,7 +615,11 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
|
|||||||
|
|
||||||
// This is just used to load something into the player with correct duration,
|
// 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
|
// 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 });
|
console.log('Making ffmpeg-assisted dummy file', { filePathArg, outPath });
|
||||||
|
|
||||||
const duration = await getDuration(filePathArg);
|
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
|
// This is just a fast way of generating an empty dummy file
|
||||||
'-f', 'lavfi', '-i', 'anullsrc=channel_layout=stereo:sample_rate=44100',
|
'-f', 'lavfi', '-i', 'anullsrc=channel_layout=stereo:sample_rate=44100',
|
||||||
'-t', duration,
|
'-t', String(duration),
|
||||||
'-acodec', 'flac',
|
'-acodec', 'flac',
|
||||||
'-y', outPath,
|
'-y', outPath,
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user