TrailerClipper 2.0.0

dotnet add package TrailerClipper --version 2.0.0
                    
NuGet\Install-Package TrailerClipper -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TrailerClipper" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TrailerClipper" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TrailerClipper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TrailerClipper --version 2.0.0
                    
#r "nuget: TrailerClipper, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TrailerClipper@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TrailerClipper&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TrailerClipper&version=2.0.0
                    
Install as a Cake Tool

TrailerClipper

NuGet ci Downloads

Cuts the intro and the trailer off video and audio files, one file or a whole folder at a time, with ffmpeg. Two packages:

  • tclipper, a command-line tool (TrailerClipper.Tool), for clipping from a terminal.
  • TrailerClipper, the library behind it, for .NET code (netstandard2.0 and net10.0, so .NET Framework 4.6.2+ and every current .NET, on Windows, macOS and Linux).

The tool

dotnet tool install -g TrailerClipper.Tool
tclipper --install-ffmpeg        # only if ffmpeg is not installed yet
tclipper <path> <trailer_length_in_milliseconds>

<path> is a file or a folder; in a folder every m4b, wav, mp3, mp4, flv, avi, mpg and mov file is clipped. The clipped copies go to a clipped folder beside the input.

tclipper Episodes 17500                  # drop the last 17.5 s of every file in Episodes
tclipper -i 3500 Episodes 17500          # and the first 3.5 s
tclipper -i 3500 Episodes                # only the first 3.5 s
tclipper -o saved.json Episodes 17500    # clip, then save these settings
tclipper -c saved.json                   # clip again with the saved settings
tclipper -z                              # write a sample TrailerClipperConfig.json
tclipper                                 # clip with TrailerClipperConfig.json from the current folder

Options: -h help; -o <file> save the settings; -c, -config <file> read them; -i, -intro <ms> remove an intro; -cf, -consoleoff no progress lines; -d delete each original after clipping; -m, -multi clip files in parallel; -a, -allfiles try every file, whatever its extension; -z write a sample config. Options go before the path. Lengths are milliseconds with . as the decimal point.

ffmpeg

TrailerClipper needs ffmpeg and ffprobe. It looks for them in TrailerClipperOptions.FFmpegDirectory, the TRAILERCLIPPER_FFMPEG environment variable, PATH, and then the folders the usual installers use (winget, Homebrew, /usr/local/bin, /usr/bin, Chocolatey, Scoop), so a fresh install works without opening a new terminal.

When ffmpeg is missing, tclipper offers to install it, and tclipper --install-ffmpeg does so directly. Either way it runs your system's package manager, which downloads a current build and checks it:

System Command tclipper runs
Windows winget install --id Gyan.FFmpeg --exact
macOS brew install ffmpeg
Linux sudo apt-get install -y ffmpeg, or sudo dnf install -y ffmpeg

TrailerClipper never downloads ffmpeg itself.

The library

dotnet add package TrailerClipper
using TrailerClipperLib;

var clipper = new TrailerClipper();
clipper.RemoveTrailers("Episodes", 17500m);                   // a file or a folder
clipper.RemoveIntros("Episodes", 3500m);
clipper.RemoveIntrosAndTrailers("Episodes", 3500m, 17500m);

clipper.RemoveTrailers(new TrailerClipperOptions("Episodes", 17500m)
{
    RemoveIntro = true,
    IntroLengthInMilliseconds = 3500m,
    OutputDirectoryPath = "Clipped",
    FFmpegDirectory = @"C:\tools\ffmpeg\bin",   // optional; see "ffmpeg" above
    OutputToConsole = false
});

ClipperCommandLineInterpreter turns the tool's arguments into TrailerClipperOptions; FFmpegLocator.Find() says where ffmpeg was found (or null).

What happens at the edges

  • A path that does not exist throws FileNotFoundException; a negative length throws ArgumentOutOfRangeException.
  • A file whose intro and trailer add up to its whole length or more is skipped, with a line on the console; nothing is written for it.
  • A file ffmpeg cannot read does not stop the batch: the other files are clipped, then an InvalidOperationException names the failures.
  • Missing ffmpeg throws ToolNotFoundException (an InvalidOperationException) whose message says how to install it.
  • The progress lines go to the console unless OutputToConsole is false.

Upgrading from 1.x

2.0.0 gives the same answers as 1.1.0 for everything 1.1.0 did right, proven against a recording of the published 1.1.0 (tests/Golden), and fixes what it did wrong: see CHANGELOG.md. The main change: ffmpeg is no longer bundled (1.1.0 carried a 2015 build inside MediaToolkit.dll, Windows only), so install it once as above. The namespace, class and method names are unchanged.

What it is not

A video editor or an ffmpeg wrapper for general use. File names containing a double quote are refused. it cuts a fixed length off the start and the end of each file, re-encoding with ffmpeg's defaults for the file's extension. It runs only the ffmpeg and ffprobe it finds and never touches the network.

Licence

MIT. ffmpeg is a separate program under its own licence (LGPL or GPL, depending on the build you install). FFMpegCore, which runs it, is MIT.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 105 9/27/2026
2.0.0-beta.1 59 9/27/2026
1.1.0 1,847 9/29/2016
1.0.9 1,615 10/20/2015
1.0.8 1,930 10/6/2015
1.0.7 1,732 10/5/2015
1.0.5 1,671 9/30/2015
1.0.4 1,631 9/30/2015
1.0.3 1,601 9/29/2015
1.0.2 1,627 9/29/2015
1.0.1 1,650 9/29/2015
1.0.0 1,678 9/29/2015