diff options
Diffstat (limited to 'server/lib/video-transcoding.ts')
-rw-r--r-- | server/lib/video-transcoding.ts | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index beef78b44..7af7a481c 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts | |||
@@ -60,7 +60,7 @@ async function optimizeOriginalVideofile (video: MVideoWithFile, inputVideoFile: | |||
60 | 60 | ||
61 | const videoOutputPath = getVideoFilePath(video, inputVideoFile) | 61 | const videoOutputPath = getVideoFilePath(video, inputVideoFile) |
62 | 62 | ||
63 | await onVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath) | 63 | await onWebTorrentVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath) |
64 | 64 | ||
65 | return transcodeType | 65 | return transcodeType |
66 | } catch (err) { | 66 | } catch (err) { |
@@ -72,7 +72,7 @@ async function optimizeOriginalVideofile (video: MVideoWithFile, inputVideoFile: | |||
72 | } | 72 | } |
73 | 73 | ||
74 | // Transcode the original video file to a lower resolution. | 74 | // Transcode the original video file to a lower resolution. |
75 | async function transcodeNewResolution (video: MVideoWithFile, resolution: VideoResolution, isPortrait: boolean, job: Job) { | 75 | async function transcodeNewWebTorrentResolution (video: MVideoWithFile, resolution: VideoResolution, isPortrait: boolean, job: Job) { |
76 | const transcodeDirectory = CONFIG.STORAGE.TMP_DIR | 76 | const transcodeDirectory = CONFIG.STORAGE.TMP_DIR |
77 | const extname = '.mp4' | 77 | const extname = '.mp4' |
78 | 78 | ||
@@ -118,7 +118,7 @@ async function transcodeNewResolution (video: MVideoWithFile, resolution: VideoR | |||
118 | 118 | ||
119 | await transcode(transcodeOptions) | 119 | await transcode(transcodeOptions) |
120 | 120 | ||
121 | return onVideoFileTranscoding(video, newVideoFile, videoTranscodedPath, videoOutputPath) | 121 | return onWebTorrentVideoFileTranscoding(video, newVideoFile, videoTranscodedPath, videoOutputPath) |
122 | } | 122 | } |
123 | 123 | ||
124 | // Merge an image with an audio file to create a video | 124 | // Merge an image with an audio file to create a video |
@@ -170,11 +170,11 @@ async function mergeAudioVideofile (video: MVideoWithAllFiles, resolution: Video | |||
170 | video.duration = await getDurationFromVideoFile(videoTranscodedPath) | 170 | video.duration = await getDurationFromVideoFile(videoTranscodedPath) |
171 | await video.save() | 171 | await video.save() |
172 | 172 | ||
173 | return onVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath) | 173 | return onWebTorrentVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath) |
174 | } | 174 | } |
175 | 175 | ||
176 | // Concat TS segments from a live video to a fragmented mp4 HLS playlist | 176 | // Concat TS segments from a live video to a fragmented mp4 HLS playlist |
177 | async function generateHlsPlaylistFromTS (options: { | 177 | async function generateHlsPlaylistResolutionFromTS (options: { |
178 | video: MVideoWithFile | 178 | video: MVideoWithFile |
179 | concatenatedTsFilePath: string | 179 | concatenatedTsFilePath: string |
180 | resolution: VideoResolution | 180 | resolution: VideoResolution |
@@ -192,7 +192,7 @@ async function generateHlsPlaylistFromTS (options: { | |||
192 | } | 192 | } |
193 | 193 | ||
194 | // Generate an HLS playlist from an input file, and update the master playlist | 194 | // Generate an HLS playlist from an input file, and update the master playlist |
195 | function generateHlsPlaylist (options: { | 195 | function generateHlsPlaylistResolution (options: { |
196 | video: MVideoWithFile | 196 | video: MVideoWithFile |
197 | videoInputPath: string | 197 | videoInputPath: string |
198 | resolution: VideoResolution | 198 | resolution: VideoResolution |
@@ -224,17 +224,22 @@ function getEnabledResolutions (type: 'vod' | 'live') { | |||
224 | // --------------------------------------------------------------------------- | 224 | // --------------------------------------------------------------------------- |
225 | 225 | ||
226 | export { | 226 | export { |
227 | generateHlsPlaylist, | 227 | generateHlsPlaylistResolution, |
228 | generateHlsPlaylistFromTS, | 228 | generateHlsPlaylistResolutionFromTS, |
229 | optimizeOriginalVideofile, | 229 | optimizeOriginalVideofile, |
230 | transcodeNewResolution, | 230 | transcodeNewWebTorrentResolution, |
231 | mergeAudioVideofile, | 231 | mergeAudioVideofile, |
232 | getEnabledResolutions | 232 | getEnabledResolutions |
233 | } | 233 | } |
234 | 234 | ||
235 | // --------------------------------------------------------------------------- | 235 | // --------------------------------------------------------------------------- |
236 | 236 | ||
237 | async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoFile, transcodingPath: string, outputPath: string) { | 237 | async function onWebTorrentVideoFileTranscoding ( |
238 | video: MVideoWithFile, | ||
239 | videoFile: MVideoFile, | ||
240 | transcodingPath: string, | ||
241 | outputPath: string | ||
242 | ) { | ||
238 | const stats = await stat(transcodingPath) | 243 | const stats = await stat(transcodingPath) |
239 | const fps = await getVideoFileFPS(transcodingPath) | 244 | const fps = await getVideoFileFPS(transcodingPath) |
240 | const metadata = await getMetadataFromFile(transcodingPath) | 245 | const metadata = await getMetadataFromFile(transcodingPath) |