mirror of https://github.com/Chocobozzz/PeerTube
More robust optimize transcoding job
parent
e5a818d3cb
commit
1d1da33661
|
@ -8,7 +8,6 @@ import { VideoResolution, VideoStorage } from '../../../shared/models/videos'
|
|||
import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
|
||||
import { transcode, TranscodeOptions, TranscodeOptionsType } from '../../helpers/ffmpeg-utils'
|
||||
import { canDoQuickTranscode, getDurationFromVideoFile, getMetadataFromFile, getVideoFileFPS } from '../../helpers/ffprobe-utils'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
import { P2P_MEDIA_LOADER_PEER_VERSION } from '../../initializers/constants'
|
||||
import { VideoFileModel } from '../../models/video/video-file'
|
||||
|
@ -62,9 +61,6 @@ function optimizeOriginalVideofile (video: MVideoFullLight, inputVideoFile: MVid
|
|||
// Could be very long!
|
||||
await transcode(transcodeOptions)
|
||||
|
||||
try {
|
||||
await remove(videoInputPath)
|
||||
|
||||
// Important to do this before getVideoFilename() to take in account the new filename
|
||||
inputVideoFile.extname = newExtname
|
||||
inputVideoFile.filename = generateWebTorrentVideoFilename(resolution, newExtname)
|
||||
|
@ -73,14 +69,9 @@ function optimizeOriginalVideofile (video: MVideoFullLight, inputVideoFile: MVid
|
|||
const videoOutputPath = VideoPathManager.Instance.getFSVideoFileOutputPath(video, inputVideoFile)
|
||||
|
||||
const { videoFile } = await onWebTorrentVideoFileTranscoding(video, inputVideoFile, videoTranscodedPath, videoOutputPath)
|
||||
await remove(videoInputPath)
|
||||
|
||||
return { transcodeType, videoFile }
|
||||
} catch (err) {
|
||||
// Auto destruction...
|
||||
video.destroy().catch(err => logger.error('Cannot destruct video after transcoding failure.', { err }))
|
||||
|
||||
throw err
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue