aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding/video-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-08 11:28:51 +0200
committerChocobozzz <me@florianbigard.com>2021-06-08 11:28:51 +0200
commit318b0bd0c2ff575f35d51d97327f77abfecd6b86 (patch)
tree095a464dc053c06bc7a9c1e6a50a18ac9a7e4dce /server/lib/transcoding/video-transcoding.ts
parent5982ffc4b5c926ea51f5bb3ca48f0f2f8f5bd621 (diff)
downloadPeerTube-318b0bd0c2ff575f35d51d97327f77abfecd6b86.tar.gz
PeerTube-318b0bd0c2ff575f35d51d97327f77abfecd6b86.tar.zst
PeerTube-318b0bd0c2ff575f35d51d97327f77abfecd6b86.zip
Fix "height not divisible by 2" ffmpeg error
Diffstat (limited to 'server/lib/transcoding/video-transcoding.ts')
-rw-r--r--server/lib/transcoding/video-transcoding.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/lib/transcoding/video-transcoding.ts b/server/lib/transcoding/video-transcoding.ts
index 5df192575..1ad63baf3 100644
--- a/server/lib/transcoding/video-transcoding.ts
+++ b/server/lib/transcoding/video-transcoding.ts
@@ -1,6 +1,7 @@
1import { Job } from 'bull' 1import { Job } from 'bull'
2import { copyFile, ensureDir, move, remove, stat } from 'fs-extra' 2import { copyFile, ensureDir, move, remove, stat } from 'fs-extra'
3import { basename, extname as extnameUtil, join } from 'path' 3import { basename, extname as extnameUtil, join } from 'path'
4import { toEven } from '@server/helpers/core-utils'
4import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 5import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
5import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 6import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
6import { VideoResolution } from '../../../shared/models/videos' 7import { VideoResolution } from '../../../shared/models/videos'
@@ -35,6 +36,8 @@ async function optimizeOriginalVideofile (video: MVideoFullLight, inputVideoFile
35 ? 'quick-transcode' 36 ? 'quick-transcode'
36 : 'video' 37 : 'video'
37 38
39 const resolution = toEven(inputVideoFile.resolution)
40
38 const transcodeOptions: TranscodeOptions = { 41 const transcodeOptions: TranscodeOptions = {
39 type: transcodeType, 42 type: transcodeType,
40 43
@@ -44,7 +47,7 @@ async function optimizeOriginalVideofile (video: MVideoFullLight, inputVideoFile
44 availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(), 47 availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(),
45 profile: CONFIG.TRANSCODING.PROFILE, 48 profile: CONFIG.TRANSCODING.PROFILE,
46 49
47 resolution: inputVideoFile.resolution, 50 resolution,
48 51
49 job 52 job
50 } 53 }
@@ -57,7 +60,7 @@ async function optimizeOriginalVideofile (video: MVideoFullLight, inputVideoFile
57 60
58 // Important to do this before getVideoFilename() to take in account the new filename 61 // Important to do this before getVideoFilename() to take in account the new filename
59 inputVideoFile.extname = newExtname 62 inputVideoFile.extname = newExtname
60 inputVideoFile.filename = generateVideoFilename(video, false, inputVideoFile.resolution, newExtname) 63 inputVideoFile.filename = generateVideoFilename(video, false, resolution, newExtname)
61 64
62 const videoOutputPath = getVideoFilePath(video, inputVideoFile) 65 const videoOutputPath = getVideoFilePath(video, inputVideoFile)
63 66