X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Ftranscoding%2Ftranscoding.ts;h=44e26754d52954e06fab0236ea3f98b8c3fe1a36;hb=367a9dc69975a0db01962dbb7106635fb8eb1696;hp=070c7ebda77018f914158d5367d38a2c414a7fca;hpb=5e2afe4290103bf0d54ae7b3e62781f2a00487c9;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/transcoding/transcoding.ts b/server/lib/transcoding/transcoding.ts index 070c7ebda..44e26754d 100644 --- a/server/lib/transcoding/transcoding.ts +++ b/server/lib/transcoding/transcoding.ts @@ -1,4 +1,4 @@ -import { Job } from 'bull' +import { Job } from 'bullmq' import { copyFile, ensureDir, move, remove, stat } from 'fs-extra' import { basename, extname as extnameUtil, join } from 'path' import { toEven } from '@server/helpers/core-utils' @@ -342,6 +342,12 @@ async function generateHlsPlaylistCommon (options: { // Move video file await move(join(videoTranscodedBasePath, videoFilename), videoFilePath, { overwrite: true }) + // Update video duration if it was not set (in case of a live for example) + if (!video.duration) { + video.duration = await getVideoStreamDuration(videoFilePath) + await video.save() + } + const stats = await stat(videoFilePath) newVideoFile.size = stats.size