From fd2a4d874577c272e0a8317f99be33092deeeba0 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Fri, 10 Nov 2017 23:50:17 +0100 Subject: [PATCH] Add an option to set the MP3 bitrate when converting (fixes #113) --- classes/Config.php | 7 +++++++ classes/VideoDownload.php | 1 + config/config.example.yml | 3 +++ tests/ConfigTest.php | 1 + 4 files changed, 12 insertions(+) diff --git a/classes/Config.php b/classes/Config.php index 6226f26..09d06c8 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -82,6 +82,13 @@ class Config */ public $remux = false; + /** + * MP3 bitrate when converting (in kbit/s) + * + * @var int + */ + public $audioBitrate = 128; + /** * YAML config file path. * diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 3140d08..9005c85 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -281,6 +281,7 @@ class VideoDownload '-user-agent', $this->getProp(null, null, 'dump-user-agent'), '-i', $url, '-f', 'mp3', + '-b:a', $this->config->audioBitrate.'k', '-vn', 'pipe:1', ] diff --git a/config/config.example.yml b/config/config.example.yml index 9470464..3479f61 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -26,3 +26,6 @@ uglyUrls: false # True to stream videos through server stream: false + +# MP3 bitrate when converting (in kbit/s) +audioBitrate: 128 diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 8e49632..5535109 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -67,6 +67,7 @@ class ConfigTest extends TestCase $this->assertInternalType('bool', $config->uglyUrls); $this->assertInternalType('bool', $config->stream); $this->assertInternalType('bool', $config->remux); + $this->assertInternalType('int', $config->audioBitrate); } /**