From: Vincent Date: Mon, 17 Feb 2020 14:58:51 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7823f910bfb1701cca686fbb32ce794bd2088845;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 635fba0..55592ea 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,7 @@ - - - @@ -1206,12 +1204,12 @@ - + - + @@ -1225,11 +1223,11 @@ - - + + - + diff --git a/scripts/lib/medialibrary.php b/scripts/lib/medialibrary.php index e7bfc0b..b7e9458 100644 --- a/scripts/lib/medialibrary.php +++ b/scripts/lib/medialibrary.php @@ -146,7 +146,8 @@ function transcodeOneVideo() sleep(15); } - $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $item->getExtension() . ' ' . getVideoCodec($path); + $resize = getVideoHeight($path) > 1080 ? ' 1' : ' 0'; + $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $item->getExtension() . ' ' . getVideoCodec($path) . $resize; print_r(sshCommand($cmd, 'avion')); return; } @@ -256,4 +257,16 @@ function getVideoDuration($path) setState($cacheKey, $res); } return $res; +} + +function getVideoHeight($path) +{ + $cacheKey = 'height_2_' . md5($path . '-' . filemtime($path)); + $res = getState($cacheKey, null); + if (null === $res) { + $res = `ffprobe -v error -select_streams v:0 -show_entries stream=height -of default=nw=1:nk=1 $path`; + $res = trim($res); + setState($cacheKey, $res); + } + return (int)$res; } \ No newline at end of file