diff options
author | Felix Ableitner <me@nutomic.com> | 2019-04-24 20:27:05 +0200 |
---|---|---|
committer | Felix Ableitner <me@nutomic.com> | 2019-05-04 03:19:49 +0200 |
commit | 5ba49f268deb76b168559fe5fe2506b0bd5af9a8 (patch) | |
tree | 120968fffb7cd14ee4028344523c453bcdd7fe4b /server/lib/video-transcoding.ts | |
parent | c342726ad4ccbb90b8ff29f1cc1c89f9f7e8d98f (diff) | |
download | PeerTube-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.ts | 9 |
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 @@ | |||
1 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers/constants' | 1 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER, VIDEO_TRANSCODING_FPS } from '../initializers/constants' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils' | 3 | import { getVideoFileFPS, transcode, canDoQuickTranscode } from '../helpers/ffmpeg-utils' |
4 | import { ensureDir, move, remove, stat } from 'fs-extra' | 4 | import { ensureDir, move, remove, stat } from 'fs-extra' |
5 | import { logger } from '../helpers/logger' | 5 | import { logger } from '../helpers/logger' |
6 | import { VideoResolution } from '../../shared/models/videos' | 6 | import { 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! |