Skip to content

Commit c0ef03a

Browse files
authored
Merge pull request #243 from mariuskli/master
--download-sections and --force-keyframes-at-cuts options
2 parents d0ff54b + e005838 commit c0ef03a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/Options.php

+28
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class Options
125125
private bool $hlsUseMpegts = false;
126126
private ?string $externalDownloader = null;
127127
private ?string $externalDownloaderArgs = null;
128+
private ?string $downloadSections = null;
128129

129130
// Filesystem Options
130131
private ?string $batchFile = null;
@@ -227,6 +228,7 @@ class Options
227228
private ?string $ffmpegLocation = null;
228229
private ?string $exec = null;
229230
private ?string $convertSubsFormat = null;
231+
private bool $forceKeyframesAtCuts = false;
230232

231233
/**
232234
* @var list<non-empty-string>
@@ -1502,6 +1504,30 @@ public function audioQuality(?string $audioQuality): self
15021504
return $new;
15031505
}
15041506

1507+
/**
1508+
* Download only chapters that match the regular expression.
1509+
*/
1510+
public function downloadSections(?string $downloadSections): self
1511+
{
1512+
$new = clone $this;
1513+
$new->downloadSections = $downloadSections;
1514+
1515+
return $new;
1516+
}
1517+
1518+
/**
1519+
* Force keyframes at cuts when downloading/splitting/removing sections.
1520+
* This is slow due to needing a re-encode, but the resulting video
1521+
* may have fewer artifacts around the cuts.
1522+
*/
1523+
public function forceKeyframesAtCuts(bool $forceKeyframesAtCuts): self
1524+
{
1525+
$new = clone $this;
1526+
$new->forceKeyframesAtCuts = $forceKeyframesAtCuts;
1527+
1528+
return $new;
1529+
}
1530+
15051531
/**
15061532
* Remux the video into another container if necessary (currently supported:
15071533
* avi, flv, gif, mkv, mov, mp4, webm, aac, aiff, alac, flac, m4a, mka, mp3, ogg,
@@ -1713,6 +1739,7 @@ public function toArray(): array
17131739
'hls-use-mpegts' => $this->hlsUseMpegts,
17141740
'external-downloader' => $this->externalDownloader,
17151741
'external-downloader-args' => $this->externalDownloaderArgs,
1742+
'download-sections' => $this->downloadSections,
17161743
// Filesystem Options
17171744
'batch-file' => $this->batchFile,
17181745
'id' => $this->id,
@@ -1797,6 +1824,7 @@ public function toArray(): array
17971824
'ffmpeg-location' => $this->ffmpegLocation,
17981825
'exec' => $this->exec,
17991826
'convert-subs-format' => $this->convertSubsFormat,
1827+
'force-keyframes-at-cuts' => $this->forceKeyframesAtCuts,
18001828
'url' => $this->url,
18011829
];
18021830
}

0 commit comments

Comments
 (0)