]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/transcoding.ts
Process video torrents in order
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / transcoding.ts
index dd6fbd3de51b0616584c7cf4d09d1cbed25fde8d..da3ea3c9c0abce4bb238933fbeddad2771e8399c 100644 (file)
@@ -1,5 +1,5 @@
 import express from 'express'
-import { computeLowerResolutionsToTranscode } from '@server/helpers/ffprobe-utils'
+import { computeLowerResolutionsToTranscode } from '@server/helpers/ffmpeg'
 import { logger, loggerTagsFactory } from '@server/helpers/logger'
 import { addTranscodingJob } from '@server/lib/video'
 import { HttpStatusCode, UserRight, VideoState, VideoTranscodingCreate } from '@shared/models'
@@ -25,11 +25,11 @@ export {
 
 async function createTranscoding (req: express.Request, res: express.Response) {
   const video = res.locals.videoAll
-  logger.info('Creating %s transcoding job for %s.', req.body.type, video.url, lTags())
+  logger.info('Creating %s transcoding job for %s.', req.body.transcodingType, video.url, lTags())
 
   const body: VideoTranscodingCreate = req.body
 
-  const { resolution: maxResolution, isPortraitMode } = await video.getMaxQualityResolution()
+  const { resolution: maxResolution, isPortraitMode, audioStream } = await video.probeMaxQualityFile()
   const resolutions = computeLowerResolutionsToTranscode(maxResolution, 'vod').concat([ maxResolution ])
 
   video.state = VideoState.TO_TRANSCODE
@@ -42,6 +42,7 @@ async function createTranscoding (req: express.Request, res: express.Response) {
         videoUUID: video.uuid,
         resolution,
         isPortraitMode,
+        hasAudio: !!audioStream,
         copyCodecs: false,
         isNewVideo: false,
         autoDeleteWebTorrentIfNeeded: false,
@@ -52,7 +53,9 @@ async function createTranscoding (req: express.Request, res: express.Response) {
         type: 'new-resolution-to-webtorrent',
         videoUUID: video.uuid,
         isNewVideo: false,
-        resolution: resolution,
+        resolution,
+        hasAudio: !!audioStream,
+        createHLSIfNeeded: false,
         isPortraitMode
       })
     }