aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding/web-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 16:31:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commitcc2abbc320ea66296bf45314a2efb47d16b38374 (patch)
tree488882ef5752d790f9e16800fb76dd3dd3cb6a7b /server/lib/transcoding/web-transcoding.ts
parent1772b383de490cf406fe93ef3aa3a941f6db513c (diff)
downloadPeerTube-cc2abbc320ea66296bf45314a2efb47d16b38374.tar.gz
PeerTube-cc2abbc320ea66296bf45314a2efb47d16b38374.tar.zst
PeerTube-cc2abbc320ea66296bf45314a2efb47d16b38374.zip
Fix next video state after optimize/audio merge
Diffstat (limited to 'server/lib/transcoding/web-transcoding.ts')
-rw-r--r--server/lib/transcoding/web-transcoding.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/lib/transcoding/web-transcoding.ts b/server/lib/transcoding/web-transcoding.ts
index d43d03b2a..22bd238ae 100644
--- a/server/lib/transcoding/web-transcoding.ts
+++ b/server/lib/transcoding/web-transcoding.ts
@@ -14,6 +14,7 @@ import { buildFileMetadata } from '../video-file'
14import { VideoPathManager } from '../video-path-manager' 14import { VideoPathManager } from '../video-path-manager'
15import { buildFFmpegVOD } from './shared' 15import { buildFFmpegVOD } from './shared'
16import { computeResolutionsToTranscode } from './transcoding-resolutions' 16import { computeResolutionsToTranscode } from './transcoding-resolutions'
17import { VideoModel } from '@server/models/video/video'
17 18
18// Optimize the original video file and replace it. The resolution is not changed. 19// Optimize the original video file and replace it. The resolution is not changed.
19export async function optimizeOriginalVideofile (options: { 20export async function optimizeOriginalVideofile (options: {
@@ -32,6 +33,7 @@ export async function optimizeOriginalVideofile (options: {
32 33
33 try { 34 try {
34 await video.reload() 35 await video.reload()
36 await inputVideoFile.reload()
35 37
36 const fileWithVideoOrPlaylist = inputVideoFile.withVideoOrPlaylist(video) 38 const fileWithVideoOrPlaylist = inputVideoFile.withVideoOrPlaylist(video)
37 39
@@ -88,16 +90,15 @@ export async function transcodeNewWebTorrentResolution (options: {
88 fps: number 90 fps: number
89 job: Job 91 job: Job
90}) { 92}) {
91 const { video, resolution, fps, job } = options 93 const { video: videoArg, resolution, fps, job } = options
92 94
93 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR 95 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR
94 const newExtname = '.mp4' 96 const newExtname = '.mp4'
95 97
96 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 98 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(videoArg.uuid)
97 99
98 try { 100 try {
99 await video.reload() 101 const video = await VideoModel.loadFull(videoArg.uuid)
100
101 const file = video.getMaxQualityFile().withVideoOrPlaylist(video) 102 const file = video.getMaxQualityFile().withVideoOrPlaylist(video)
102 103
103 const result = await VideoPathManager.Instance.makeAvailableVideoFile(file, async videoInputPath => { 104 const result = await VideoPathManager.Instance.makeAvailableVideoFile(file, async videoInputPath => {
@@ -141,16 +142,15 @@ export async function mergeAudioVideofile (options: {
141 fps: number 142 fps: number
142 job: Job 143 job: Job
143}) { 144}) {
144 const { video, resolution, fps, job } = options 145 const { video: videoArg, resolution, fps, job } = options
145 146
146 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR 147 const transcodeDirectory = CONFIG.STORAGE.TMP_DIR
147 const newExtname = '.mp4' 148 const newExtname = '.mp4'
148 149
149 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 150 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(videoArg.uuid)
150 151
151 try { 152 try {
152 await video.reload() 153 const video = await VideoModel.loadFull(videoArg.uuid)
153
154 const inputVideoFile = video.getMinQualityFile() 154 const inputVideoFile = video.getMinQualityFile()
155 155
156 const fileWithVideoOrPlaylist = inputVideoFile.withVideoOrPlaylist(video) 156 const fileWithVideoOrPlaylist = inputVideoFile.withVideoOrPlaylist(video)