pull/2119/head
Mikael Finstad 2024-09-26 13:39:16 +02:00
rodzic 7d306f7736
commit 9c733742a2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 25AB36E3E81CBC26
2 zmienionych plików z 25 dodań i 7 usunięć

Wyświetl plik

@ -1598,9 +1598,9 @@ function App() {
const tryFixInvalidDuration = useCallback(async () => { const tryFixInvalidDuration = useCallback(async () => {
if (!checkFileOpened() || workingRef.current) return; if (!checkFileOpened() || workingRef.current) return;
try { try {
setWorking({ text: i18n.t('Fixing file duration') });
setProgress(0);
await withErrorHandling(async () => { await withErrorHandling(async () => {
setWorking({ text: i18n.t('Fixing file duration') });
setProgress(0);
invariant(fileFormat != null); invariant(fileFormat != null);
const path = await fixInvalidDuration({ fileFormat, customOutDir, onProgress: setProgress }); const path = await fixInvalidDuration({ fileFormat, customOutDir, onProgress: setProgress });
showNotification({ icon: 'info', text: i18n.t('Duration has been fixed') }); showNotification({ icon: 'info', text: i18n.t('Duration has been fixed') });

Wyświetl plik

@ -235,8 +235,26 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
keyframeCut: ssBeforeInput, avoidNegativeTs, copyFileStreams, cutFrom, cutTo, chaptersPath, onProgress, outPath, keyframeCut: ssBeforeInput, avoidNegativeTs, copyFileStreams, cutFrom, cutTo, chaptersPath, onProgress, outPath,
videoDuration, rotation, allFilesMeta, outFormat, shortestFlag, ffmpegExperimental, preserveMovData, movFastStart, customTagsByFile, paramsByStreamId, videoTimebase, detectedFps, videoDuration, rotation, allFilesMeta, outFormat, shortestFlag, ffmpegExperimental, preserveMovData, movFastStart, customTagsByFile, paramsByStreamId, videoTimebase, detectedFps,
}: { }: {
keyframeCut: boolean, avoidNegativeTs: AvoidNegativeTs | undefined, copyFileStreams: CopyfileStreams, cutFrom: number, cutTo: number, chaptersPath?: string | undefined, onProgress: (p: number) => void, outPath: string, keyframeCut: boolean,
videoDuration: number | undefined, rotation: number | undefined, allFilesMeta: AllFilesMeta, outFormat: string, shortestFlag: boolean, ffmpegExperimental: boolean, preserveMovData: boolean, movFastStart: boolean, customTagsByFile: CustomTagsByFile, paramsByStreamId: ParamsByStreamId, videoTimebase?: number | undefined, detectedFps?: number, avoidNegativeTs: AvoidNegativeTs | undefined,
copyFileStreams: CopyfileStreams,
cutFrom: number,
cutTo: number,
chaptersPath?: string | undefined,
onProgress: (p: number) => void,
outPath: string,
videoDuration: number | undefined,
rotation: number | undefined,
allFilesMeta: AllFilesMeta,
outFormat: string,
shortestFlag: boolean,
ffmpegExperimental: boolean,
preserveMovData: boolean,
movFastStart: boolean,
customTagsByFile: CustomTagsByFile,
paramsByStreamId: ParamsByStreamId,
videoTimebase?: number | undefined,
detectedFps?: number,
}) => { }) => {
if (await shouldSkipExistingFile(outPath)) return; if (await shouldSkipExistingFile(outPath)) return;
@ -413,8 +431,8 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
console.log('customTagsByFile', customTagsByFile); console.log('customTagsByFile', customTagsByFile);
console.log('paramsByStreamId', paramsByStreamId); console.log('paramsByStreamId', paramsByStreamId);
const singleProgresses = {}; const singleProgresses: Record<number, number> = {};
function onSingleProgress(id, singleProgress) { function onSingleProgress(id: number, singleProgress: number) {
singleProgresses[id] = singleProgress; singleProgresses[id] = singleProgress;
return onTotalProgress((sum(Object.values(singleProgresses)) / segments.length)); return onTotalProgress((sum(Object.values(singleProgresses)) / segments.length));
} }
@ -425,7 +443,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
// or if enabled, will first cut&encode the part before the next keyframe, trying to match the input file's codec params // or if enabled, will first cut&encode the part before the next keyframe, trying to match the input file's codec params
// then it will cut the part *from* the keyframe to "end", and concat them together and return the concated file // then it will cut the part *from* the keyframe to "end", and concat them together and return the concated file
// so that for the calling code it looks as if it's just a normal segment // so that for the calling code it looks as if it's just a normal segment
async function maybeSmartCutSegment({ start: desiredCutFrom, end: cutTo }, i) { async function maybeSmartCutSegment({ start: desiredCutFrom, end: cutTo }: { start: number, end: number }, i: number) {
async function makeSegmentOutPath() { async function makeSegmentOutPath() {
const outPath = join(outputDir, outSegFileNames[i]!); const outPath = join(outputDir, outSegFileNames[i]!);
// because outSegFileNames might contain slashes https://github.com/mifi/lossless-cut/issues/1532 // because outSegFileNames might contain slashes https://github.com/mifi/lossless-cut/issues/1532