Clean up intermediate render files during xfade
This commit is contained in:
@@ -450,6 +450,11 @@ final class VideoProcessor: ObservableObject {
|
||||
clipNumber: clipNumber,
|
||||
totalClips: videos.count
|
||||
)
|
||||
if !settings.keepIntermediateClips {
|
||||
removeTemporaryFile(segmentURL)
|
||||
removeTemporaryFile(stabilizedURL)
|
||||
removeTemporaryFile(tempDirectory.appendingPathComponent(String(format: "clip_%04d.trf", clipNumber)))
|
||||
}
|
||||
} else {
|
||||
try await normalizeSourceSegment(
|
||||
source: video.url,
|
||||
@@ -808,6 +813,10 @@ final class VideoProcessor: ObservableObject {
|
||||
throw VideoProcessingError.ffmpegFailed("Xfade Übergang \(index)", result.output)
|
||||
}
|
||||
|
||||
if !settings.keepIntermediateClips {
|
||||
removeTemporaryFile(current)
|
||||
removeTemporaryFile(next)
|
||||
}
|
||||
current = out
|
||||
currentDuration += settings.targetClipLength - settings.transitionLength
|
||||
progress = 0.75 + (Double(index) / Double(totalSteps)) * 0.25
|
||||
@@ -834,6 +843,17 @@ final class VideoProcessor: ObservableObject {
|
||||
try FileManager.default.copyItem(at: source, to: outputFile)
|
||||
}
|
||||
|
||||
private func removeTemporaryFile(_ url: URL) {
|
||||
guard FileManager.default.fileExists(atPath: url.path) else {
|
||||
return
|
||||
}
|
||||
do {
|
||||
try FileManager.default.removeItem(at: url)
|
||||
} catch {
|
||||
appendLog("Warnung: Temporäre Datei konnte nicht gelöscht werden: \(url.lastPathComponent) (\(error.localizedDescription))")
|
||||
}
|
||||
}
|
||||
|
||||
private func escapeConcatPath(_ path: String) -> String {
|
||||
path.replacingOccurrences(of: "'", with: "'\\''")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user