aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-08 16:50:56 +0200
committerChocobozzz <me@florianbigard.com>2018-10-08 16:50:56 +0200
commit9f1ddd249652c1e35b45db33885a00a005f9b059 (patch)
tree193c941c0019e897abf1e12faa504fff912f5546 /server/lib/video-transcoding.ts
parentedb4ffc7e0b13659d7c73b120f2c87b27e4c26a1 (diff)
downloadPeerTube-9f1ddd249652c1e35b45db33885a00a005f9b059.tar.gz
PeerTube-9f1ddd249652c1e35b45db33885a00a005f9b059.tar.zst
PeerTube-9f1ddd249652c1e35b45db33885a00a005f9b059.zip
Change a little bit optimize-old-videos logic
Diffstat (limited to 'server/lib/video-transcoding.ts')
-rw-r--r--server/lib/video-transcoding.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index 04cadf74b..a78de61e5 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -1,5 +1,5 @@
1import { CONFIG } from '../initializers' 1import { CONFIG } from '../initializers'
2import { join, extname, basename } from 'path' 2import { extname, join } from 'path'
3import { getVideoFileFPS, getVideoFileResolution, transcode } from '../helpers/ffmpeg-utils' 3import { getVideoFileFPS, getVideoFileResolution, transcode } from '../helpers/ffmpeg-utils'
4import { copy, remove, rename, stat } from 'fs-extra' 4import { copy, remove, rename, stat } from 'fs-extra'
5import { logger } from '../helpers/logger' 5import { logger } from '../helpers/logger'
@@ -7,16 +7,12 @@ import { VideoResolution } from '../../shared/models/videos'
7import { VideoFileModel } from '../models/video/video-file' 7import { VideoFileModel } from '../models/video/video-file'
8import { VideoModel } from '../models/video/video' 8import { VideoModel } from '../models/video/video'
9 9
10async function optimizeVideofile (video: VideoModel, videoInputPath?: string) { 10async function optimizeVideofile (video: VideoModel, inputVideoFileArg?: VideoFileModel) {
11 const videosDirectory = CONFIG.STORAGE.VIDEOS_DIR 11 const videosDirectory = CONFIG.STORAGE.VIDEOS_DIR
12 const newExtname = '.mp4' 12 const newExtname = '.mp4'
13 let inputVideoFile = null 13
14 if (videoInputPath == null) { 14 const inputVideoFile = inputVideoFileArg ? inputVideoFileArg : video.getOriginalFile()
15 inputVideoFile = video.getOriginalFile() 15 const videoInputPath = join(videosDirectory, video.getVideoFilename(inputVideoFile))
16 videoInputPath = join(videosDirectory, video.getVideoFilename(inputVideoFile))
17 } else {
18 inputVideoFile = basename(videoInputPath)
19 }
20 const videoTranscodedPath = join(videosDirectory, video.id + '-transcoded' + newExtname) 16 const videoTranscodedPath = join(videosDirectory, video.id + '-transcoded' + newExtname)
21 17
22 const transcodeOptions = { 18 const transcodeOptions = {