From 8c0ed9d9f4d67544fe0337887b4dd51b5bbc0d01 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 9 Dec 2017 23:56:34 +0100 Subject: [PATCH] Don't set ffmpeg user agent when it is reading from a pipe --- classes/VideoDownload.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 7480d8b..03ab854 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -273,19 +273,22 @@ class VideoDownload throw(new \Exception('Can\'t find avconv or ffmpeg')); } - $builder = ProcessBuilder::create( - [ - $this->config->avconv, - '-v', $this->config->avconvVerbosity, - //Vimeo needs a correct user-agent - '-user_agent', $this->getProp(null, null, 'dump-user-agent'), - '-i', $url, - '-f', 'mp3', - '-b:a', $this->config->audioBitrate.'k', - '-vn', - 'pipe:1', - ] - ); + $arguments = [ + $this->config->avconv, + '-v', $this->config->avconvVerbosity, + '-i', $url, + '-f', 'mp3', + '-b:a', $this->config->audioBitrate.'k', + '-vn', + 'pipe:1', + ]; + if ($url != '-') { + //Vimeo needs a correct user-agent + $arguments[] = '-user_agent'; + $arguments[] = $this->getProp(null, null, 'dump-user-agent'); + } + + $builder = ProcessBuilder::create($arguments); return $builder->getProcess(); }