About

Transcode is a command-line tool that converts whole directories of video files in one run. It wraps Lisa Melton’s Video Transcoding, which converts one file per invocation, and applies the same workflow to every video in a directory with a single command.

Transcode can:

  • Convert an entire directory to .m4v in a single run.

  • Select the main audio and burned-in subtitle stream for each file.

  • Extract audio to .mp3.

  • Scan files to list their available audio and subtitle streams.

  • Print a summary table of the results.

It recognizes these input formats: avi, flv, m2ts, m4v, mkv, mp4, mpg, mpeg, mov, ts, webm, vob, and wmv.

Installation

Transcode ships as a Ruby gem and requires Ruby 3.2 or later. It runs on macOS, GNU/Linux, Windows, and any other system Ruby supports. See Installing Ruby if Ruby 3.2+ is not available on your platform.

Install with:

gem install transcode

Updating

Update with:

gem update transcode

Requirements

See Video Transcoding’s requirements for external dependencies.

Usage

transcode [options]
  -a, --act      Perform actual encoding.
  -u, --aud aud  Audio stream numbers.
  -d, --dir dir  Source directory to transcode.
  -m, --mp3      Convert files to MP3.
  -o, --out out  Output directory.
  -s, --sca      Scan files in the directory.
  -t, --sub sub  Subtitle stream numbers.
  -i, --tit tit  Specific title number.
  -v, --version  Show version.
  -w, --wid wid  Width of the table.

Transcode performs a dry run by default. It prints the commands it would run and a summary table without changing any files. Pass --act to start the encoding.

Without --dir and --out, Transcode reads from and writes to the current directory. The --aud and --sub options take comma-separated stream numbers, either one value applied to every file or one value per file.

Examples

Scan the source directory to inspect the available audio and subtitle streams:

transcode --sca --dir [source]

Transcode three files from [source] to [destination] with the selected audio and subtitle streams. Add --act once the plan looks right:

transcode \
  --act \
  --aud 1,3,1 \
  --dir [source] \
  --out [destination] \
  --sub 2,1,3

Extract the audio of every file in the current directory to .mp3:

transcode --mp3 --act

License

transcode is copyright David Rabkin and available under a Zero-Clause BSD license.