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

Add Safe video trim mode to circumvent rare encoding issues #1112

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Implement in CLI
  • Loading branch information
ScrubN committed Jun 26, 2024
commit d807eb50925a505e83230c4ab2e831ceef90cc87
4 changes: 4 additions & 0 deletions TwitchDownloaderCLI/Modes/Arguments/VideoDownloadArgs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CommandLine;
using TwitchDownloaderCLI.Models;
using TwitchDownloaderCore.Tools;

namespace TwitchDownloaderCLI.Modes.Arguments
{
@@ -27,6 +28,9 @@ internal sealed class VideoDownloadArgs : IFileCollisionArgs, ITwitchDownloaderA
[Option("bandwidth", Default = -1, HelpText = "The maximum bandwidth a thread will be allowed to use in kibibytes per second (KiB/s), or -1 for no maximum.")]
public int ThrottleKib { get; set; }

[Option("trim-mode", Default = VideoTrimMode.Exact, HelpText = "Sets the trim handling. Videos trimmed with exact trim may rarely experience video/audio stuttering within the first/last few seconds. Safe trimming is guaranteed to not stutter but may result in a slightly longer video. Valid values are: Safe, Exact")]
public VideoTrimMode TrimMode { get; set; }

[Option("oauth", HelpText = "OAuth access token to download subscriber only VODs. DO NOT SHARE THIS WITH ANYONE.")]
public string Oauth { get; set; }

1 change: 1 addition & 0 deletions TwitchDownloaderCLI/Modes/DownloadVideo.cs
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ private static VideoDownloadOptions GetDownloadOptions(VideoDownloadArgs inputOp
TrimBeginningTime = inputOptions.TrimBeginningTime,
TrimEnding = inputOptions.TrimEndingTime > TimeSpan.Zero,
TrimEndingTime = inputOptions.TrimEndingTime,
TrimMode = inputOptions.TrimMode,
FfmpegPath = string.IsNullOrWhiteSpace(inputOptions.FfmpegPath) ? FfmpegHandler.FfmpegExecutableName : Path.GetFullPath(inputOptions.FfmpegPath),
TempFolder = inputOptions.TempFolder,
CacheCleanerCallback = directoryInfos =>
3 changes: 3 additions & 0 deletions TwitchDownloaderCLI/README.md
Original file line number Diff line number Diff line change
@@ -57,6 +57,9 @@ Time to trim ending. See [Time durations](#time-durations) for a more detailed e
**--bandwidth**
(Default: `-1`) The maximum bandwidth a thread will be allowed to use in kibibytes per second (KiB/s), or `-1` for no maximum.

**--trim-mode**
(Default: `Exact`) Sets the video trim handling. Videos trimmed with exact trim may rarely experience video/audio stuttering within the first/last few seconds. Safe trimming is guaranteed to not stutter but may result in a slightly longer video. Valid values are: `Safe`, `Exact`.

**--oauth**
OAuth access token to download subscriber only VODs. <ins>**DO NOT SHARE YOUR OAUTH TOKEN WITH ANYONE.**</ins>