diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-06 13:35:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-06 14:13:26 +0200 |
commit | 679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3 (patch) | |
tree | 03abf589275db05e5b1fa1c89f57049cd807324a /server/lib/job-queue/handlers/video-file-import.ts | |
parent | c826f34a45757b324a20f71665b44ed10e6953b5 (diff) | |
download | PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.tar.gz PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.tar.zst PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.zip |
Improve target bitrate calculation
Diffstat (limited to 'server/lib/job-queue/handlers/video-file-import.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-file-import.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index 4d199f247..2f4abf730 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts | |||
@@ -32,7 +32,7 @@ async function processVideoFileImport (job: Bull.Job) { | |||
32 | const newResolutionPayload = { | 32 | const newResolutionPayload = { |
33 | type: 'new-resolution-to-webtorrent' as 'new-resolution-to-webtorrent', | 33 | type: 'new-resolution-to-webtorrent' as 'new-resolution-to-webtorrent', |
34 | videoUUID: video.uuid, | 34 | videoUUID: video.uuid, |
35 | resolution: data.videoFileResolution, | 35 | resolution: data.resolution, |
36 | isPortraitMode: data.isPortraitMode, | 36 | isPortraitMode: data.isPortraitMode, |
37 | copyCodecs: false, | 37 | copyCodecs: false, |
38 | isNewVideo: false | 38 | isNewVideo: false |
@@ -51,13 +51,13 @@ export { | |||
51 | // --------------------------------------------------------------------------- | 51 | // --------------------------------------------------------------------------- |
52 | 52 | ||
53 | async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) { | 53 | async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) { |
54 | const { videoFileResolution } = await getVideoFileResolution(inputFilePath) | 54 | const { resolution } = await getVideoFileResolution(inputFilePath) |
55 | const { size } = await stat(inputFilePath) | 55 | const { size } = await stat(inputFilePath) |
56 | const fps = await getVideoFileFPS(inputFilePath) | 56 | const fps = await getVideoFileFPS(inputFilePath) |
57 | 57 | ||
58 | const fileExt = getLowercaseExtension(inputFilePath) | 58 | const fileExt = getLowercaseExtension(inputFilePath) |
59 | 59 | ||
60 | const currentVideoFile = video.VideoFiles.find(videoFile => videoFile.resolution === videoFileResolution) | 60 | const currentVideoFile = video.VideoFiles.find(videoFile => videoFile.resolution === resolution) |
61 | 61 | ||
62 | if (currentVideoFile) { | 62 | if (currentVideoFile) { |
63 | // Remove old file and old torrent | 63 | // Remove old file and old torrent |
@@ -69,9 +69,9 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | const newVideoFile = new VideoFileModel({ | 71 | const newVideoFile = new VideoFileModel({ |
72 | resolution: videoFileResolution, | 72 | resolution, |
73 | extname: fileExt, | 73 | extname: fileExt, |
74 | filename: generateWebTorrentVideoFilename(videoFileResolution, fileExt), | 74 | filename: generateWebTorrentVideoFilename(resolution, fileExt), |
75 | size, | 75 | size, |
76 | fps, | 76 | fps, |
77 | videoId: video.id | 77 | videoId: video.id |