aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-09-09 09:21:42 +0200
committerChocobozzz <me@florianbigard.com>2022-09-09 09:21:42 +0200
commite4fc3697acb27c4192cbbb63eb94272a6cf7ce32 (patch)
tree96daedbbbc030920bae25816dd15a16a8c85fb8f /server/lib/job-queue/handlers
parent405c83f9af377a663a4c8e9ad025fd5c10496922 (diff)
downloadPeerTube-e4fc3697acb27c4192cbbb63eb94272a6cf7ce32.tar.gz
PeerTube-e4fc3697acb27c4192cbbb63eb94272a6cf7ce32.tar.zst
PeerTube-e4fc3697acb27c4192cbbb63eb94272a6cf7ce32.zip
Fix saved live master playlist bandwidth
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts14
1 files changed, 2 insertions, 12 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 79002258c..8a3ee09a2 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -1,7 +1,7 @@
1import { Job } from 'bullmq' 1import { Job } from 'bullmq'
2import { readdir, remove } from 'fs-extra' 2import { readdir, remove } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamDuration } from '@server/helpers/ffmpeg' 4import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo } from '@server/helpers/ffmpeg'
5import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 5import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
6import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' 6import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'
7import { cleanupPermanentLive, cleanupTMPLiveFiles, cleanupUnsavedNormalLive } from '@server/lib/live' 7import { cleanupPermanentLive, cleanupTMPLiveFiles, cleanupUnsavedNormalLive } from '@server/lib/live'
@@ -203,8 +203,6 @@ async function assignReplayFilesToVideo (options: {
203}) { 203}) {
204 const { video, replayDirectory } = options 204 const { video, replayDirectory } = options
205 205
206 let durationDone = false
207
208 const concatenatedTsFiles = await readdir(replayDirectory) 206 const concatenatedTsFiles = await readdir(replayDirectory)
209 207
210 for (const concatenatedTsFile of concatenatedTsFiles) { 208 for (const concatenatedTsFile of concatenatedTsFiles) {
@@ -212,22 +210,14 @@ async function assignReplayFilesToVideo (options: {
212 210
213 const probe = await ffprobePromise(concatenatedTsFilePath) 211 const probe = await ffprobePromise(concatenatedTsFilePath)
214 const { audioStream } = await getAudioStream(concatenatedTsFilePath, probe) 212 const { audioStream } = await getAudioStream(concatenatedTsFilePath, probe)
215
216 const { resolution } = await getVideoStreamDimensionsInfo(concatenatedTsFilePath, probe) 213 const { resolution } = await getVideoStreamDimensionsInfo(concatenatedTsFilePath, probe)
217 214
218 const { resolutionPlaylistPath: outputPath } = await generateHlsPlaylistResolutionFromTS({ 215 await generateHlsPlaylistResolutionFromTS({
219 video, 216 video,
220 concatenatedTsFilePath, 217 concatenatedTsFilePath,
221 resolution, 218 resolution,
222 isAAC: audioStream?.codec_name === 'aac' 219 isAAC: audioStream?.codec_name === 'aac'
223 }) 220 })
224
225 if (!durationDone) {
226 video.duration = await getVideoStreamDuration(outputPath)
227 await video.save()
228
229 durationDone = true
230 }
231 } 221 }
232 222
233 return video 223 return video