aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-transcoding.ts
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2019-04-24 20:27:05 +0200
committerFelix Ableitner <me@nutomic.com>2019-05-04 03:19:49 +0200
commit5ba49f268deb76b168559fe5fe2506b0bd5af9a8 (patch)
tree120968fffb7cd14ee4028344523c453bcdd7fe4b /server/lib/video-transcoding.ts
parentc342726ad4ccbb90b8ff29f1cc1c89f9f7e8d98f (diff)
downloadPeerTube-5ba49f268deb76b168559fe5fe2506b0bd5af9a8.tar.gz
PeerTube-5ba49f268deb76b168559fe5fe2506b0bd5af9a8.tar.zst
PeerTube-5ba49f268deb76b168559fe5fe2506b0bd5af9a8.zip
Dont transcode videos when it is not required (fixes #1780)
Diffstat (limited to 'server/lib/video-transcoding.ts')
-rw-r--r--server/lib/video-transcoding.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index 0fe0ff12a..05afb44d1 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -1,6 +1,6 @@
1import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers/constants' 1import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER, VIDEO_TRANSCODING_FPS } from '../initializers/constants'
2import { join } from 'path' 2import { join } from 'path'
3import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils' 3import { getVideoFileFPS, transcode, canDoQuickTranscode } from '../helpers/ffmpeg-utils'
4import { ensureDir, move, remove, stat } from 'fs-extra' 4import { ensureDir, move, remove, stat } from 'fs-extra'
5import { logger } from '../helpers/logger' 5import { logger } from '../helpers/logger'
6import { VideoResolution } from '../../shared/models/videos' 6import { VideoResolution } from '../../shared/models/videos'
@@ -19,10 +19,13 @@ async function optimizeVideofile (video: VideoModel, inputVideoFileArg?: VideoFi
19 const videoInputPath = join(videosDirectory, video.getVideoFilename(inputVideoFile)) 19 const videoInputPath = join(videosDirectory, video.getVideoFilename(inputVideoFile))
20 const videoTranscodedPath = join(videosDirectory, video.id + '-transcoded' + newExtname) 20 const videoTranscodedPath = join(videosDirectory, video.id + '-transcoded' + newExtname)
21 21
22 const doQuickTranscode = await(canDoQuickTranscode(videoInputPath))
23
22 const transcodeOptions = { 24 const transcodeOptions = {
23 inputPath: videoInputPath, 25 inputPath: videoInputPath,
24 outputPath: videoTranscodedPath, 26 outputPath: videoTranscodedPath,
25 resolution: inputVideoFile.resolution 27 resolution: inputVideoFile.resolution,
28 doQuickTranscode
26 } 29 }
27 30
28 // Could be very long! 31 // Could be very long!