Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Merge branch 'release/v8.2.x' into develop

Chocobozzze23214feb7b6
diff --cc server/core/lib/transcoding/hls-transcoding.ts
index cb3b62891b,5e7bba9ec5..6f3a50be75
--- a/server/core/lib/transcoding/hls-transcoding.ts
+++ b/server/core/lib/transcoding/hls-transcoding.ts
@@@ -216,15 -212,21 +217,21 @@@ async function generateHlsPlaylistCommo
}
}
- await buildFFmpegVOD({ job, abortSignal }).transcode(transcodeOptions)
+ try {
- await buildFFmpegVOD(job).transcode(transcodeOptions)
++ await buildFFmpegVOD({ job, abortSignal }).transcode(transcodeOptions)
- // Ensure the mutex is released if the ffmpeg command failed and did not release it
- if (inputFileMutexReleaser) inputFileMutexReleaser()
+ // Ensure the mutex is released if the ffmpeg command failed and did not release it
+ if (inputFileMutexReleaser) inputFileMutexReleaser()
- await onHLSVideoFileTranscoding({
- video,
- videoOutputPath,
- preventInputFileLocking,
- m3u8OutputPath
- })
+ await onHLSVideoFileTranscoding({
+ video,
+ videoOutputPath,
+ preventInputFileLocking,
+ m3u8OutputPath
+ })
+ } finally {
+ // Cleanup temporary files
+ deleteFileAndCatch(videoOutputPath)
+ deleteFileAndCatch(m3u8OutputPath)
+ }
}
diff --cc server/core/lib/transcoding/web-transcoding.ts
index c14d519388,11bb79dca5..3524742401
--- a/server/core/lib/transcoding/web-transcoding.ts
+++ b/server/core/lib/transcoding/web-transcoding.ts
@@@ -52,22 -52,27 +53,27 @@@ export async function optimizeOriginalV
const resolution = buildOriginalFileResolution(inputVideoFile.resolution)
const fps = computeOutputFPS({ inputFPS: inputVideoFile.fps, resolution, isOriginResolution: true, type: 'vod' })
- // Could be very long!
- await buildFFmpegVOD({ job, abortSignal }).transcode({
- type: transcodeType,
+ try {
+ // Could be very long!
- await buildFFmpegVOD(job).transcode({
++ await buildFFmpegVOD({ job, abortSignal }).transcode({
+ type: transcodeType,
- videoInputPath,
- outputPath: videoOutputPath,
+ videoInputPath,
+ outputPath: videoOutputPath,
- inputFileMutexReleaser,
+ inputFileMutexReleaser,
- resolution,
- fps
- })
+ resolution,
+ fps
+ })
- const { videoFile } = await onWebVideoFileTranscoding({ video, videoOutputPath, deleteWebInputVideoFile: inputVideoFile })
+ const { videoFile } = await onWebVideoFileTranscoding({ video, videoOutputPath, deleteWebInputVideoFile: inputVideoFile })
- return { transcodeType, videoFile }
+ return { transcodeType, videoFile }
+ } finally {
+ // Cleanup temporary files
+ deleteFileAndCatch(videoOutputPath)
+ }
})
return result
@@@ -112,9 -116,14 +118,14 @@@ export async function transcodeNewWebVi
fps
}
- await buildFFmpegVOD({ job, abortSignal }).transcode(transcodeOptions)
+ try {
- await buildFFmpegVOD(job).transcode(transcodeOptions)
++ await buildFFmpegVOD({ job, abortSignal }).transcode(transcodeOptions)
- return onWebVideoFileTranscoding({ video, videoOutputPath })
+ return await onWebVideoFileTranscoding({ video, videoOutputPath })
+ } finally {
+ // Cleanup temporary files
+ deleteFileAndCatch(videoOutputPath)
+ }
})
return result
@@@ -165,20 -173,19 +176,19 @@@ export async function mergeAudioVideofi
}
try {
- await buildFFmpegVOD(job).transcode(transcodeOptions)
+ await buildFFmpegVOD({ job, abortSignal }).transcode(transcodeOptions)
- await remove(tmpThumbnailPath)
- } catch (err) {
- await remove(tmpThumbnailPath)
- throw err
+ await onWebVideoFileTranscoding({
+ video,
+ videoOutputPath,
+ deleteWebInputVideoFile: inputVideoFile,
+ wasAudioFile: true
+ })
+ } finally {
+ // Cleanup temporary files
+ deleteFileAndCatch(tmpThumbnailPath)
+ deleteFileAndCatch(videoOutputPath)
}
-
- await onWebVideoFileTranscoding({
- video,
- videoOutputPath,
- deleteWebInputVideoFile: inputVideoFile,
- wasAudioFile: true
- })
})
return result