]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/v1/videos.js
Move video duration logic in lib/
[github/Chocobozzz/PeerTube.git] / server / controllers / api / v1 / videos.js
index e696289619f9ac4f75a1286a88ff5fb507f466e2..7fdc50e5239d742ecd33d086237bc54afc8c018e 100644 (file)
@@ -3,7 +3,6 @@
 const config = require('config')
 const crypto = require('crypto')
 const express = require('express')
-const ffmpeg = require('fluent-ffmpeg')
 const multer = require('multer')
 
 const logger = require('../../../helpers/logger')
@@ -61,15 +60,13 @@ function addVideo (req, res, next) {
       return next(err)
     }
 
-    ffmpeg.ffprobe(video_file.path, function (err, metadata) {
+    videos.getVideoDuration(video_file.path, function (err, duration) {
       if (err) {
         // TODO: unseed the video
         logger.error('Cannot retrieve metadata of the file')
         return next(err)
       }
 
-      const duration = Math.floor(metadata.format.duration)
-
       const video_data = {
         name: video_infos.name,
         namePath: video_file.filename,