aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-24 16:29:39 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-25 10:07:51 +0100
commit6b67897e2eab96978daee40aeaf716835856d65d (patch)
tree2a203bf589599061a62c4e42b0e580a1c61b47ee /server/lib/video-transcoding.ts
parent33ff70baa64c6315856066682595878a27b7ed8c (diff)
downloadPeerTube-6b67897e2eab96978daee40aeaf716835856d65d.tar.gz
PeerTube-6b67897e2eab96978daee40aeaf716835856d65d.tar.zst
PeerTube-6b67897e2eab96978daee40aeaf716835856d65d.zip
Add transcoding module comments
Diffstat (limited to 'server/lib/video-transcoding.ts')
-rw-r--r--server/lib/video-transcoding.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index aaad219dd..e022f2a68 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -16,8 +16,13 @@ import { generateVideoStreamingPlaylistName, getVideoFilename, getVideoFilePath
16import { availableEncoders } from './video-transcoding-profiles' 16import { availableEncoders } from './video-transcoding-profiles'
17 17
18/** 18/**
19 * Optimize the original video file and replace it. The resolution is not changed. 19 *
20 * Functions that run transcoding functions, update the database, cleanup files, create torrent files...
21 * Mainly called by the job queue
22 *
20 */ 23 */
24
25// Optimize the original video file and replace it. The resolution is not changed.
21async function optimizeOriginalVideofile (video: MVideoWithFile, inputVideoFileArg?: MVideoFile) { 26async function optimizeOriginalVideofile (video: MVideoWithFile, inputVideoFileArg?: MVideoFile) {
22 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR 27 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR
23 const newExtname = '.mp4' 28 const newExtname = '.mp4'
@@ -62,9 +67,7 @@ async function optimizeOriginalVideofile (video: MVideoWithFile, inputVideoFileA
62 } 67 }
63} 68}
64 69
65/** 70// Transcode the original video file to a lower resolution.
66 * Transcode the original video file to a lower resolution.
67 */
68async function transcodeNewResolution (video: MVideoWithFile, resolution: VideoResolution, isPortrait: boolean) { 71async function transcodeNewResolution (video: MVideoWithFile, resolution: VideoResolution, isPortrait: boolean) {
69 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR 72 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR
70 const extname = '.mp4' 73 const extname = '.mp4'
@@ -110,6 +113,7 @@ async function transcodeNewResolution (video: MVideoWithFile, resolution: VideoR
110 return onVideoFileTranscoding(video, newVideoFile, videoTranscodedPath, videoOutputPath) 113 return onVideoFileTranscoding(video, newVideoFile, videoTranscodedPath, videoOutputPath)
111} 114}
112 115
116// Merge an image with an audio file to create a video
113async function mergeAudioVideofile (video: MVideoWithAllFiles, resolution: VideoResolution) { 117async function mergeAudioVideofile (video: MVideoWithAllFiles, resolution: VideoResolution) {
114 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR 118 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR
115 const newExtname = '.mp4' 119 const newExtname = '.mp4'
@@ -159,6 +163,7 @@ async function mergeAudioVideofile (video: MVideoWithAllFiles, resolution: Video
159 return onVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath) 163 return onVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath)
160} 164}
161 165
166// Generate an HLS playlist from an input file, and update the master playlist
162async function generateHlsPlaylist (options: { 167async function generateHlsPlaylist (options: {
163 video: MVideoWithFile 168 video: MVideoWithFile
164 videoInputPath: string 169 videoInputPath: string