Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--download-sections and --force-keyframes-at-cuts options #243

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -227,6 +228,7 @@ class Options
private ?string $ffmpegLocation = null;
private ?string $exec = null;
private ?string $convertSubsFormat = null;
private bool $forceKeyframesAtCuts = false;

/**
* @var list<non-empty-string>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
];
}
Expand Down