aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-19 11:20:10 +0200
committerChocobozzz <me@florianbigard.com>2022-04-19 11:20:10 +0200
commitf692fc8d6f186c0535599c5c2321d896e41bdb98 (patch)
treec48c841d829d3dea22486e6c4af63529fca9e1b1 /server/middlewares
parentacc6a1cba7eb65076aef15fd4fa764648ca85208 (diff)
downloadPeerTube-f692fc8d6f186c0535599c5c2321d896e41bdb98.tar.gz
PeerTube-f692fc8d6f186c0535599c5c2321d896e41bdb98.tar.zst
PeerTube-f692fc8d6f186c0535599c5c2321d896e41bdb98.zip
Support uploads of videos with unknown duration
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/videos/videos.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 26597cf7b..0b6b8bfe5 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -646,9 +646,10 @@ export async function isVideoAccepted (
646} 646}
647 647
648async function addDurationToVideo (videoFile: { path: string, duration?: number }) { 648async function addDurationToVideo (videoFile: { path: string, duration?: number }) {
649 const duration: number = await getVideoStreamDuration(videoFile.path) 649 const duration = await getVideoStreamDuration(videoFile.path)
650 650
651 if (isNaN(duration)) throw new Error(`Couldn't get video duration`) 651 // FFmpeg may not be able to guess video duration
652 652 // For example with m2v files: https://trac.ffmpeg.org/ticket/9726#comment:2
653 videoFile.duration = duration 653 if (isNaN(duration)) videoFile.duration = 0
654 else videoFile.duration = duration
654} 655}