From 5baf95f6de22506c0ca54f1aba86be492ec2a168 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 28 May 2020 20:55:58 -0400 Subject: [PATCH] improve video encoding speed --- docker/web/nginx.conf | 4 ++-- lib/philomena/processors/webm.ex | 15 +++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/docker/web/nginx.conf b/docker/web/nginx.conf index fc7b3cad..6d590d5b 100644 --- a/docker/web/nginx.conf +++ b/docker/web/nginx.conf @@ -11,13 +11,13 @@ server { client_max_body_size 30M; client_body_buffer_size 128k; - location ~ ^/img/view/(.+)/([0-9]+).*\.([A-Za-z]+)$ { + location ~ ^/img/view/(.+)/([0-9]+).*\.([A-Za-z0-9]+)$ { expires max; add_header Cache-Control public; alias "$APP_DIR/priv/static/system/images/thumbs/$1/$2/full.$3"; } - location ~ ^/img/download/(.+)/([0-9]+).*\.([A-Za-z]+)$ { + location ~ ^/img/download/(.+)/([0-9]+).*\.([A-Za-z0-9]+)$ { add_header Content-Disposition "attachment"; expires max; add_header Cache-Control public; diff --git a/lib/philomena/processors/webm.ex b/lib/philomena/processors/webm.ex index 26285668..84c9ac10 100644 --- a/lib/philomena/processors/webm.ex +++ b/lib/philomena/processors/webm.ex @@ -99,19 +99,10 @@ defmodule Philomena.Processors.Webm do "-vf", scale_filter, "-threads", - "1", + "4", "-max_muxing_queue_size", "4096", - webm - ]) - - {_output, 0} = - System.cmd("ffmpeg", [ - "-loglevel", - "0", - "-y", - "-i", - file, + webm, "-c:v", "libx264", "-pix_fmt", @@ -127,7 +118,7 @@ defmodule Philomena.Processors.Webm do "-vf", scale_filter, "-threads", - "1", + "4", "-max_muxing_queue_size", "4096", mp4