aboutsummaryrefslogtreecommitdiff
path: root/src/server/DashUploadUtils.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2021-03-30 11:00:02 -0400
committerusodhi <61431818+usodhi@users.noreply.github.com>2021-03-30 11:00:02 -0400
commit479dff344ff2cf92ace9c68c3ce6d03e6e6dce22 (patch)
tree85db5d0f69dc8afaae4c5ea5e6d1492d831fc7f1 /src/server/DashUploadUtils.ts
parent4df769e20b9588fea61b602ec67ca2208fc3d747 (diff)
parent47f4f4ce91bd7deacaa04526418341d1f6006404 (diff)
merging
Diffstat (limited to 'src/server/DashUploadUtils.ts')
-rw-r--r--src/server/DashUploadUtils.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts
index d9b38c014..ff6b2381c 100644
--- a/src/server/DashUploadUtils.ts
+++ b/src/server/DashUploadUtils.ts
@@ -16,6 +16,7 @@ import { resolvedServerUrl } from "./server_Initialization";
import { AcceptableMedia, Upload } from './SharedMediaTypes';
import request = require('request-promise');
const parse = require('pdf-parse');
+const ffmpeg = require("fluent-ffmpeg");
const requestImageSize = require("../client/util/request-image-size");
export enum SizeSuffix {
@@ -62,7 +63,7 @@ export namespace DashUploadUtils {
const category = types[0];
let format = `.${types[1]}`;
- console.log(green(`Processing upload of file (${name}) with upload type (${type}) in category (${category}).`));
+ console.log(green(`Processing upload of file (${name}) and format (${format}) with upload type (${type}) in category (${category}).`));
switch (category) {
case "image":
@@ -71,6 +72,14 @@ export namespace DashUploadUtils {
return { source: file, result };
}
case "video":
+ if (format.includes("x-matroska")) {
+ await new Promise(res => ffmpeg(file.path)
+ .videoCodec("copy") // this will copy the data instead of reencode it
+ .save(file.path.replace(".mkv", ".mp4"))
+ .on('end', res));
+ file.path = file.path.replace(".mkv", ".mp4");
+ format = ".mp4";
+ }
if (videoFormats.includes(format)) {
return MoveParsedFile(file, Directory.videos);
}