]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/ffmpeg-utils.ts
Refactor video edit css
[github/Chocobozzz/PeerTube.git] / server / helpers / ffmpeg-utils.ts
index aa4223cdabdc9cc12eb798bcbe86f4d1506e4f77..f79b70469d92d408793dd4955786e9335ee3a5ed 100644 (file)
@@ -396,8 +396,8 @@ async function buildx264VODCommand (command: ffmpeg.FfmpegCommand, options: Tran
 
   if (options.resolution !== undefined) {
     scaleFilterValue = options.isPortraitMode === true
-      ? `${options.resolution}:-2`
-      : `-2:${options.resolution}`
+      ? `w=${options.resolution}:h=-2`
+      : `w=-2:h=${options.resolution}`
   }
 
   command = await presetVideo({ command, input: options.inputPath, transcodeOptions: options, fps, scaleFilterValue })
@@ -679,10 +679,16 @@ function getFFmpegVersion () {
 
       return execPromise(`${ffmpegPath} -version`)
         .then(stdout => {
-          const parsed = stdout.match(/ffmpeg version .?(\d+\.\d+\.\d+)/)
+          const parsed = stdout.match(/ffmpeg version .?(\d+\.\d+(\.\d+)?)/)
           if (!parsed || !parsed[1]) return rej(new Error(`Could not find ffmpeg version in ${stdout}`))
 
-          return res(parsed[1])
+          // Fix ffmpeg version that does not include patch version (4.4 for example)
+          let version = parsed[1]
+          if (version.match(/^\d+\.\d+/)) {
+            version += '.0'
+          }
+
+          return res(version)
         })
         .catch(err => rej(err))
     })