Skip to content

Commit

Permalink
--download-sections and --force-keyframes-at-cuts options
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuskli committed Aug 27, 2024
1 parent d0ff54b commit e005838
Showing 1 changed file with 28 additions and 0 deletions.
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

0 comments on commit e005838

Please sign in to comment.