aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/hls.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/lib/hls.ts b/server/lib/hls.ts
index 943721dd7..c94b599df 100644
--- a/server/lib/hls.ts
+++ b/server/lib/hls.ts
@@ -1,7 +1,7 @@
1import { basename, dirname, join } from 'path' 1import { basename, dirname, join } from 'path'
2import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants' 2import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants'
3import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' 3import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra'
4import { getVideoFileSize } from '../helpers/ffmpeg-utils' 4import { getVideoStreamSize, getAudioStreamCodec, getVideoStreamCodec } from '../helpers/ffmpeg-utils'
5import { sha256 } from '../helpers/core-utils' 5import { sha256 } from '../helpers/core-utils'
6import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' 6import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
7import { logger } from '../helpers/logger' 7import { logger } from '../helpers/logger'
@@ -42,7 +42,7 @@ async function updateMasterHLSPlaylist (video: MVideoWithFile) {
42 42
43 const videoFilePath = getVideoFilePath(streamingPlaylist, file) 43 const videoFilePath = getVideoFilePath(streamingPlaylist, file)
44 44
45 const size = await getVideoFileSize(videoFilePath) 45 const size = await getVideoStreamSize(videoFilePath)
46 46
47 const bandwidth = 'BANDWIDTH=' + video.getBandwidthBits(file) 47 const bandwidth = 'BANDWIDTH=' + video.getBandwidthBits(file)
48 const resolution = `RESOLUTION=${size.width}x${size.height}` 48 const resolution = `RESOLUTION=${size.width}x${size.height}`
@@ -50,6 +50,10 @@ async function updateMasterHLSPlaylist (video: MVideoWithFile) {
50 let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}` 50 let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}`
51 if (file.fps) line += ',FRAME-RATE=' + file.fps 51 if (file.fps) line += ',FRAME-RATE=' + file.fps
52 52
53 const audioCodec = await getAudioStreamCodec(filePlaylistPath)
54 const videoCodec = await getVideoStreamCodec(filePlaylistPath)
55 line += `,CODECS="${videoCodec},${audioCodec}"`
56
53 masterPlaylists.push(line) 57 masterPlaylists.push(line)
54 masterPlaylists.push(VideoStreamingPlaylistModel.getHlsPlaylistFilename(file.resolution)) 58 masterPlaylists.push(VideoStreamingPlaylistModel.getHlsPlaylistFilename(file.resolution))
55 } 59 }