Skip to content
m4bwav edited this page Oct 1, 2026 · 1 revision

tclipper is the command-line front of the library, from the TrailerClipper.Tool package (install it). It has one job, so it has one command with options, plus --install-ffmpeg.

tclipper [options] <path> <trailer_length_in_milliseconds>
tclipper [options] -i <intro_ms> <path>
tclipper -c <config_file>
tclipper -z
tclipper
tclipper --install-ffmpeg

The transcripts below are real runs of the published 2.0.0 by its path, on Windows 11 with ffmpeg 9.0.1, each on a fresh copy of the folders it names. They are shown the way a POSIX shell shows them: both streams in the order they were written, then echo $? for the exit code. <cwd> stands for the full path of the current folder. On Linux the separators in paths are /.

Options

Option What it does
-h, -help prints the help text and exits with 0, whatever else is on the line
-i <ms>, -intro <ms> also removes an intro of this length
-o <file> after clipping, saves these settings to <file> (Configuration)
-c <file>, -config <file> clips with the settings saved in <file>; must be the first argument
-cf, -consoleoff no progress lines
-d deletes each original after its clipped copy is written
-m, -multi clips the files of a folder in parallel
-a, -allfiles tries every file in a folder, whatever its extension
-z writes a sample TrailerClipperConfig.json to the current folder
--install-ffmpeg installs ffmpeg with your package manager; must be the first argument

Options other than --install-ffmpeg are matched without regard to case or surrounding spaces. Lengths are milliseconds with . as the decimal point in every culture. The path and the trailer length are read from the end of the line: the last argument is the trailer length and the one before it is the path, so put options first. The exception is -i <ms>, which may also come after the path.

Help

$ tclipper -h
-h - Displays this help
-o <output_filename> - outputs the configuration of the clipping to file, so that the configuration can be used again.
-c, -config <config_filepath> - reads the clipping parameters from a file, rather than from the command-line
-i, -intro <intro_length_in_milliseconds> - This options allows you to trim an intro rather than a trailer.  Can be used with or without the trailer trimming functionality
-cf, -consoleoff - Turns off logging output to console
-d - delete the original files that are trimmed, off by default
-m, -multi - Use multi-tasking, experimental, generally does not increase the speed of the trimming, but may show slight improvement
-a, -allfiles - Process files that don't have a valid file extension as well as those that do.  Off by default
-z - To create a default configuration file if desired

Standard Usage - Remove trailer:
TClipper <path> <trailer_length_in_milliseconds>
<path> can be a single file or a directory
$ echo $?
0

The help text is 1.1.0's, unchanged: it names the command TClipper (type tclipper; on Linux and macOS the case matters), and it does not mention --install-ffmpeg.

Remove a trailer

$ tclipper Episodes 2000
Starting on file: Episodes\ep1.mp4
Finished on trimming file, output: <cwd>\Episodes\clipped\ep1.mp4
Starting on file: Episodes\ep2.mp3
Finished on trimming file, output: <cwd>\Episodes\clipped\ep2.mp3
Starting on file: Episodes\ep3.wav
Finished on trimming file, output: <cwd>\Episodes\clipped\ep3.wav
Starting on file: Episodes\ep4.m4b
Finished on trimming file, output: <cwd>\Episodes\clipped\ep4.m4b
$ echo $?
0

The folder afterwards (each 10-second file is now 8 seconds; the .mkv and .txt files were skipped):

Episodes/clipped/ep1.mp4: 8.000 s; video h264, audio aac
Episodes/clipped/ep2.mp3: 8.000 s; audio mp3
Episodes/clipped/ep3.wav: 8.000 s; audio pcm_s16le
Episodes/clipped/ep4.m4b: 8.011 s; audio aac
Episodes/ep1.mp4: 10.000 s; video h264, audio aac
Episodes/ep2.mp3: 10.000 s; audio mp3
Episodes/ep3.wav: 10.000 s; audio pcm_s16le
Episodes/ep4.m4b: 10.000 s; audio aac
Episodes/extra.mkv: 10.003 s; video h264, audio vorbis
Episodes/notes.txt: 10 bytes, not media

A single file works the same way; the copy goes to a clipped folder beside it:

$ tclipper Episodes/ep2.mp3 2000
Starting on file: Episodes/ep2.mp3
Finished on trimming file, output: <cwd>\Episodes\clipped\ep2.mp3
$ echo $?
0

Remove an intro, with or without a trailer

tclipper -i 1500 Episodes 2000 removes both and leaves 6.5-second copies. With no trailer length, only the intro goes, and -i may come before or after the path:

$ tclipper Episodes -i 1500
Starting on file: Episodes\ep1.mp4
Finished on trimming file, output: <cwd>\Episodes\clipped\ep1.mp4
Starting on file: Episodes\ep2.mp3
Finished on trimming file, output: <cwd>\Episodes\clipped\ep2.mp3
Starting on file: Episodes\ep3.wav
Finished on trimming file, output: <cwd>\Episodes\clipped\ep3.wav
Starting on file: Episodes\ep4.m4b
Finished on trimming file, output: <cwd>\Episodes\clipped\ep4.m4b
$ echo $?
0
Episodes/clipped/ep1.mp4: 8.500 s; video h264, audio aac
Episodes/clipped/ep2.mp3: 8.500 s; audio mp3
Episodes/clipped/ep3.wav: 8.500 s; audio pcm_s16le
Episodes/clipped/ep4.m4b: 8.500 s; audio aac

1.1.0 could not do this: it read the intro length as the path (Versions and upgrading).

Quiet, delete, every file, in parallel

-cf silences the progress lines, and -d deletes each original once its copy is written:

$ tclipper -cf -d Episodes 2000
$ echo $?
0
Episodes/clipped/ep1.mp4: 8.000 s; video h264, audio aac
Episodes/clipped/ep2.mp3: 8.000 s; audio mp3
Episodes/clipped/ep3.wav: 8.000 s; audio pcm_s16le
Episodes/clipped/ep4.m4b: 8.011 s; audio aac
Episodes/extra.mkv: 10.003 s; video h264, audio vorbis
Episodes/notes.txt: 10 bytes, not media

-a clips files whatever their extension; here a folder with a WAV and a Matroska file:

$ tclipper -a Mixed 2000
Starting on file: Mixed\ep3.wav
Finished on trimming file, output: <cwd>\Mixed\clipped\ep3.wav
Starting on file: Mixed\extra.mkv
Finished on trimming file, output: <cwd>\Mixed\clipped\extra.mkv
$ echo $?
0

With -a, a file ffmpeg cannot read (a .txt) or cannot write back (a file with no extension) makes the run end with exit code 1 after the other files are done (Errors and edge cases).

-m clips the files in parallel. tclipper -m -cf Episodes 2000 left the same four 8-second copies as the plain run. With progress lines on, their order under -m depends on which file finishes first, so the run shown here used -cf.

Save settings and use them again

-o <file> writes the settings after clipping, and -c <file> clips again with them:

$ tclipper -cf -o saved.json Episodes 2000
$ echo $?
0
$ tclipper -c saved.json
$ echo $?
0

saved.json holds one entry with every option:

saved.json: [{"OutputToConsole":false,"MultiTaskFiles":false,"OutputDirectoryPath":null,"ProcessEveryFile":false,"RemoveIntro":false,"DeleteOriginalFiles":false,"IntroLengthInMilliseconds":0,"InputPath":"Episodes","TrailerLengthInMilliSeconds":2000,"OutputClippingConfigToFile":false,"ClippingConfigOutputFilePath":null,"IsInputPathADirectory":true}]

The second run was silent because -cf was saved too. A file you write by hand can hold several entries, one per folder (Recipes). The file format is on Configuration.

No arguments, and the sample file

With no arguments, tclipper clips with TrailerClipperConfig.json from the current folder. Without one:

$ tclipper
No parameters and no config file available, use -h for help
$ echo $?
0

-z writes a sample TrailerClipperConfig.json. Its InputPath is Original, so running tclipper straight after it fails unless you have a folder by that name:

$ tclipper -z
$ echo $?
0
$ tclipper
File or directory at: Original does not exist, nothing to clip.
$ echo $?
1

Edit the file first (Configuration). -z never overwrites an existing TrailerClipperConfig.json.

Arguments it cannot use

Each of these exits with 1 and clips nothing:

$ tclipper Episodes
Incorrect parameters, try 'TClipper [<options>] <input_directory_path> <trailer_duration_in_milliseconds>'
$ echo $?
1
$ tclipper Episodes abc
Incorrect parameter, new duration in milliseconds: 'abc' cannot be parsed
$ echo $?
1
$ tclipper Missing 2000
Incorrect parameter, input directory or file: 'Missing' does not exist
$ echo $?
1
$ tclipper Episodes 2000,5
Incorrect parameter, new duration in milliseconds: '2000,5' cannot be parsed
$ echo $?
1
$ tclipper Episodes -2000
Trailer length must not be negative: -2000 (Parameter 'options')
$ echo $?
1
$ tclipper -i abc Episodes 2000
Incorrect parameter, intro length in milliseconds: 'abc' cannot be parsed
$ echo $?
1
$ tclipper -c
An option is missing its value (-c <config_filepath>, -o <output_filename>). Use -h for help.
$ echo $?
1
$ tclipper -c nope.json
Cannot find config file: nope.json
$ echo $?
1
$ tclipper --version
Incorrect parameters, try 'TClipper [<options>] <input_directory_path> <trailer_duration_in_milliseconds>'
$ echo $?
1

A comma is refused in every culture. 1.1.0 parsed lengths in the current culture: its recording reads 2000,5 as 20005 under en-US and 2000.5 as 20005 under de-DE (Versions and upgrading).

-o with no file name

-o takes the next argument as the file name without checking it. In tclipper -cf -o Episodes 2000 that is the folder Episodes: the files are clipped, and then writing the settings to a folder fails with an unhandled exception and a stack trace (first lines shown):

$ tclipper -cf -o Episodes 2000
Unhandled exception. System.UnauthorizedAccessException: Access to the path '<cwd>\Episodes' is denied.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)

The exit code was -532462766 (0xE0434352, the .NET crash code on Windows). On Linux the same run printed an inner System.IO.IOException: Permission denied, the shell printed Aborted, and the exit code was 134. This is the one user mistake found that 2.0.0 does not turn into a message with exit code 1.

Which stream, and the exit codes

Progress lines and the messages about arguments (the Incorrect parameter... lines and the no-config line) go to stdout. Errors from clipping, reading a settings file, and finding ffmpeg go to stderr. Run directly with the streams apart:

$ tclipper Broken 2000
-- stdout
Starting on file: Broken\ep3.wav
Finished on trimming file, output: <cwd>\Broken\clipped\ep3.wav
-- stderr
ffprobe could not read 'Broken\bad.mp3': ffprobe exited with non-zero exit-code (1 - [mp3 @ <address>] Failed to find two consecutive MPEG audio frames. | Broken\bad.mp3: Invalid data found when processing input)
-- exit 1

<address> stands for a memory address ffmpeg prints, different on every run.

Exit code When
0 clipped (or nothing to clip and no error), help shown, sample written, ffmpeg already installed or installed
1 arguments it cannot use, a missing path or settings file, a settings file it cannot read, a file ffmpeg could not read or write (after the other files are done), ffmpeg not found and not installed
other an unhandled exception, as with -o and no file name above

--install-ffmpeg

tclipper --install-ffmpeg installs ffmpeg through the operating system's package manager. It never downloads ffmpeg itself. It runs, the first one found:

System Command
Windows winget install --id Gyan.FFmpeg --exact --silent --accept-package-agreements --accept-source-agreements
macOS brew install ffmpeg (also found at /opt/homebrew/bin/brew or /usr/local/bin/brew when not on PATH)
Linux sudo apt-get install -y ffmpeg, or sudo dnf install -y ffmpeg

The table comes from the tool's source; none of these installs was run for these pages. What was run are the paths that stop before any install:

When ffmpeg is already found, it says where and exits with 0:

$ tclipper --install-ffmpeg
ffmpeg and ffprobe are already installed in <home>\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-9.0.1-full_build\bin
$ echo $?
0

When it is not found and standard input is not a terminal (a script, a pipe, CI), it refuses to run a package manager unasked. On Ubuntu with ffmpeg off PATH and apt-get on it:

$ tclipper --install-ffmpeg
Not a terminal, so not asking: run 'tclipper --install-ffmpeg --yes' to install without a question.
$ echo $?
1

With no package manager on PATH:

$ tclipper --install-ffmpeg
No supported package manager found (winget, brew, apt-get or dnf). ffmpeg and ffprobe were not found. Install ffmpeg (Windows: winget install --id Gyan.FFmpeg -e; macOS: brew install ffmpeg; Linux: sudo apt install ffmpeg or sudo dnf install ffmpeg), or run 'tclipper --install-ffmpeg', or point TrailerClipperOptions.FFmpegDirectory or the TRAILERCLIPPER_FFMPEG environment variable at the folder that holds them.
$ echo $?
1

In a terminal it asks Run '<command>'? [Y/n] first; --yes (or -y) after --install-ffmpeg skips the question. Neither the question nor --yes was run for these pages. After an install it looks for ffmpeg again, including the winget and Homebrew folders a terminal opened before the install cannot see on its PATH, and exits with 0 only if it finds it.

When a clip finds no ffmpeg

A clipping command that finds no ffmpeg says so on stderr and offers the install, but only in a terminal. Without a terminal (Ubuntu, ffmpeg not on PATH or in any known folder):

$ tclipper Episodes 2000
ffmpeg and ffprobe were not found; tclipper needs them to clip.
ffmpeg and ffprobe were not found. Install ffmpeg (Windows: winget install --id Gyan.FFmpeg -e; macOS: brew install ffmpeg; Linux: sudo apt install ffmpeg or sudo dnf install ffmpeg), or run 'tclipper --install-ffmpeg', or point TrailerClipperOptions.FFmpegDirectory or the TRAILERCLIPPER_FFMPEG environment variable at the folder that holds them.
$ echo $?
1

In a terminal it asks Install ffmpeg now with '<command>'? [Y/n], installs on yes, and then runs the same command again (not tested). Where tclipper looks for ffmpeg is on Configuration; the tool has no option to name the folder, so use the TRAILERCLIPPER_FFMPEG variable.

Clone this wiki locally