diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/hls.ts | 8 |
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 @@ | |||
1 | import { basename, dirname, join } from 'path' | 1 | import { basename, dirname, join } from 'path' |
2 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants' | 2 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants' |
3 | import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' | 3 | import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' |
4 | import { getVideoFileSize } from '../helpers/ffmpeg-utils' | 4 | import { getVideoStreamSize, getAudioStreamCodec, getVideoStreamCodec } from '../helpers/ffmpeg-utils' |
5 | import { sha256 } from '../helpers/core-utils' | 5 | import { sha256 } from '../helpers/core-utils' |
6 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' | 6 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' |
7 | import { logger } from '../helpers/logger' | 7 | import { 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 | } |