diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-07 15:08:19 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-02-11 09:13:02 +0100 |
commit | 4c280004ce62bf11ddb091854c28f1e1d54a54d6 (patch) | |
tree | 1899fff4ef18f8663a865997d5d06119b2149319 /server/helpers | |
parent | 6ec0b75beb9c8bcd84e178912319913b91830da2 (diff) | |
download | PeerTube-4c280004ce62bf11ddb091854c28f1e1d54a54d6.tar.gz PeerTube-4c280004ce62bf11ddb091854c28f1e1d54a54d6.tar.zst PeerTube-4c280004ce62bf11ddb091854c28f1e1d54a54d6.zip |
Use a single file instead of segments for HLS
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 12 | ||||
-rw-r--r-- | server/helpers/requests.ts | 2 | ||||
-rw-r--r-- | server/helpers/utils.ts | 1 |
3 files changed, 9 insertions, 6 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 5ad8ed48e..133b1b03b 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -122,7 +122,9 @@ type TranscodeOptions = { | |||
122 | resolution: VideoResolution | 122 | resolution: VideoResolution |
123 | isPortraitMode?: boolean | 123 | isPortraitMode?: boolean |
124 | 124 | ||
125 | generateHlsPlaylist?: boolean | 125 | hlsPlaylist?: { |
126 | videoFilename: string | ||
127 | } | ||
126 | } | 128 | } |
127 | 129 | ||
128 | function transcode (options: TranscodeOptions) { | 130 | function transcode (options: TranscodeOptions) { |
@@ -161,14 +163,16 @@ function transcode (options: TranscodeOptions) { | |||
161 | command = command.withFPS(fps) | 163 | command = command.withFPS(fps) |
162 | } | 164 | } |
163 | 165 | ||
164 | if (options.generateHlsPlaylist) { | 166 | if (options.hlsPlaylist) { |
165 | const segmentFilename = `${dirname(options.outputPath)}/${options.resolution}_%03d.ts` | 167 | const videoPath = `${dirname(options.outputPath)}/${options.hlsPlaylist.videoFilename}` |
166 | 168 | ||
167 | command = command.outputOption('-hls_time 4') | 169 | command = command.outputOption('-hls_time 4') |
168 | .outputOption('-hls_list_size 0') | 170 | .outputOption('-hls_list_size 0') |
169 | .outputOption('-hls_playlist_type vod') | 171 | .outputOption('-hls_playlist_type vod') |
170 | .outputOption('-hls_segment_filename ' + segmentFilename) | 172 | .outputOption('-hls_segment_filename ' + videoPath) |
173 | .outputOption('-hls_segment_type fmp4') | ||
171 | .outputOption('-f hls') | 174 | .outputOption('-f hls') |
175 | .outputOption('-hls_flags single_file') | ||
172 | } | 176 | } |
173 | 177 | ||
174 | command | 178 | command |
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 3fc776f1a..5c6dc5e19 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -7,7 +7,7 @@ import { join } from 'path' | |||
7 | 7 | ||
8 | function doRequest <T> ( | 8 | function doRequest <T> ( |
9 | requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean } | 9 | requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean } |
10 | ): Bluebird<{ response: request.RequestResponse, body: any }> { | 10 | ): Bluebird<{ response: request.RequestResponse, body: T }> { |
11 | if (requestOptions.activityPub === true) { | 11 | if (requestOptions.activityPub === true) { |
12 | if (!Array.isArray(requestOptions.headers)) requestOptions.headers = {} | 12 | if (!Array.isArray(requestOptions.headers)) requestOptions.headers = {} |
13 | requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER | 13 | requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER |
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index 3c3406e38..cb0e823c5 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts | |||
@@ -7,7 +7,6 @@ import { join } from 'path' | |||
7 | import { Instance as ParseTorrent } from 'parse-torrent' | 7 | import { Instance as ParseTorrent } from 'parse-torrent' |
8 | import { remove } from 'fs-extra' | 8 | import { remove } from 'fs-extra' |
9 | import * as memoizee from 'memoizee' | 9 | import * as memoizee from 'memoizee' |
10 | import { isArray } from './custom-validators/misc' | ||
11 | 10 | ||
12 | function deleteFileAsync (path: string) { | 11 | function deleteFileAsync (path: string) { |
13 | remove(path) | 12 | remove(path) |