1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 18:32:34 +01:00
This commit is contained in:
Mikael Finstad 2022-02-23 21:46:18 +08:00
parent 684a45b694
commit 12960ffb57
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
2 changed files with 8 additions and 8 deletions

View File

@ -199,7 +199,7 @@ const App = memo(() => {
} = useUserPreferences();
const {
mergeFiles: ffmpegMergeFiles, html5ifyDummy, cutMultiple, autoMergeSegments, html5ify, fixInvalidDuration,
concatFiles, html5ifyDummy, cutMultiple, autoMergeSegments, html5ify, fixInvalidDuration,
} = useFfmpegOperations({ filePath, enableTransferTimestamps });
const outSegTemplateOrDefault = outSegTemplate || defaultOutSegTemplate;
@ -695,7 +695,7 @@ const App = memo(() => {
}
// console.log('merge', paths);
await ffmpegMergeFiles({ paths, outPath, outDir, fileFormat: fileFormat2, includeAllStreams, ffmpegExperimental, onProgress: setCutProgress, preserveMovData, movFastStart, preserveMetadataOnMerge, chapters: chaptersFromSegments });
await concatFiles({ paths, outPath, outDir, fileFormat: fileFormat2, includeAllStreams, ffmpegExperimental, onProgress: setCutProgress, preserveMovData, movFastStart, preserveMetadataOnMerge, chapters: chaptersFromSegments });
openDirToast({ icon: 'success', dirPath: outDir, text: i18n.t('Files merged!') });
} catch (err) {
if (isOutOfSpaceError(err)) {
@ -708,7 +708,7 @@ const App = memo(() => {
setWorking();
setCutProgress();
}
}, [setWorking, ensureAccessibleDirectories, customOutDir, segmentsToChapters, ffmpegMergeFiles, ffmpegExperimental, preserveMovData, movFastStart, preserveMetadataOnMerge]);
}, [setWorking, ensureAccessibleDirectories, customOutDir, segmentsToChapters, concatFiles, ffmpegExperimental, preserveMovData, movFastStart, preserveMetadataOnMerge]);
const concatCurrentBatch = useCallback(() => {
if (batchFiles.length < 2) {

View File

@ -236,7 +236,7 @@ function useFfmpegOperations({ filePath, enableTransferTimestamps }) {
}
}, [filePath, optionalTransferTimestamps]);
const mergeFiles = useCallback(async ({ paths, outDir, outPath, allStreams, outFormat, ffmpegExperimental, onProgress = () => {}, preserveMovData, movFastStart, chapters, preserveMetadataOnMerge }) => {
const concatFiles = useCallback(async ({ paths, outDir, outPath, includeAllStreams, outFormat, ffmpegExperimental, onProgress = () => {}, preserveMovData, movFastStart, chapters, preserveMetadataOnMerge }) => {
console.log('Merging files', { paths }, 'to', outPath);
const durations = await pMap(paths, getDuration, { concurrency: 1 });
@ -277,7 +277,7 @@ function useFfmpegOperations({ filePath, enableTransferTimestamps }) {
}
let map;
if (allStreams) map = ['-map', '0'];
if (includeAllStreams) map = ['-map', '0'];
// If preserveMetadataOnMerge option is enabled, we need to explicitly map even if allStreams=false.
// We cannot use the ffmpeg's automatic stream selection or else ffmpeg might use the metadata source input (index 1)
// instead of the concat input (index 0)
@ -349,9 +349,9 @@ function useFfmpegOperations({ filePath, enableTransferTimestamps }) {
const chapters = await createChaptersFromSegments({ segmentPaths, chapterNames });
await mergeFiles({ paths: segmentPaths, outDir, outPath, outFormat, allStreams: true, ffmpegExperimental, onProgress, preserveMovData, movFastStart, chapters, preserveMetadataOnMerge });
await concatFiles({ paths: segmentPaths, outDir, outPath, outFormat, includeAllStreams: true, ffmpegExperimental, onProgress, preserveMovData, movFastStart, chapters, preserveMetadataOnMerge });
if (autoDeleteMergedSegments) await pMap(segmentPaths, path => fs.unlink(path), { concurrency: 5 });
}, [filePath, mergeFiles]);
}, [concatFiles, filePath]);
const html5ify = useCallback(async ({ customOutDir, filePath: filePathArg, speed, hasAudio, hasVideo, onProgress }) => {
const outPath = getHtml5ifiedPath(customOutDir, filePathArg, speed);
@ -512,7 +512,7 @@ function useFfmpegOperations({ filePath, enableTransferTimestamps }) {
}, [filePath, optionalTransferTimestamps]);
return {
cutMultiple, mergeFiles, html5ify, html5ifyDummy, fixInvalidDuration, autoMergeSegments,
cutMultiple, concatFiles, html5ify, html5ifyDummy, fixInvalidDuration, autoMergeSegments,
};
}