From e00583824b5a8287d40c51637f56db5d85d0478c Mon Sep 17 00:00:00 2001 From: Marius Klivecka Date: Tue, 27 Aug 2024 10:06:41 +0300 Subject: [PATCH] --download-sections and --force-keyframes-at-cuts options --- src/Options.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Options.php b/src/Options.php index e15faf9..38a55a1 100644 --- a/src/Options.php +++ b/src/Options.php @@ -125,6 +125,7 @@ class Options private bool $hlsUseMpegts = false; private ?string $externalDownloader = null; private ?string $externalDownloaderArgs = null; + private ?string $downloadSections = null; // Filesystem Options private ?string $batchFile = null; @@ -227,6 +228,7 @@ class Options private ?string $ffmpegLocation = null; private ?string $exec = null; private ?string $convertSubsFormat = null; + private bool $forceKeyframesAtCuts = false; /** * @var list @@ -1502,6 +1504,30 @@ public function audioQuality(?string $audioQuality): self return $new; } + /** + * Download only chapters that match the regular expression. + */ + public function downloadSections(?string $downloadSections): self + { + $new = clone $this; + $new->downloadSections = $downloadSections; + + return $new; + } + + /** + * Force keyframes at cuts when downloading/splitting/removing sections. + * This is slow due to needing a re-encode, but the resulting video + * may have fewer artifacts around the cuts. + */ + public function forceKeyframesAtCuts(bool $forceKeyframesAtCuts): self + { + $new = clone $this; + $new->forceKeyframesAtCuts = $forceKeyframesAtCuts; + + return $new; + } + /** * Remux the video into another container if necessary (currently supported: * avi, flv, gif, mkv, mov, mp4, webm, aac, aiff, alac, flac, m4a, mka, mp3, ogg, @@ -1713,6 +1739,7 @@ public function toArray(): array 'hls-use-mpegts' => $this->hlsUseMpegts, 'external-downloader' => $this->externalDownloader, 'external-downloader-args' => $this->externalDownloaderArgs, + 'download-sections' => $this->downloadSections, // Filesystem Options 'batch-file' => $this->batchFile, 'id' => $this->id, @@ -1797,6 +1824,7 @@ public function toArray(): array 'ffmpeg-location' => $this->ffmpegLocation, 'exec' => $this->exec, 'convert-subs-format' => $this->convertSubsFormat, + 'force-keyframes-at-cuts' => $this->forceKeyframesAtCuts, 'url' => $this->url, ]; }