aufmt v1.0.1
Aufmt
Overview
Aufmt is a rule-based audio and video encoder. It can be used to transcode media into your preferred formats using ffmpeg
as a backend. See the provided config/example.js
for an example of how to configure your encoding rules.
Install it from NPM:
npm install -g aufmt
Usage
To see the provided documentation, use aufmt --help
.
Inspecing files
You can use the aufmt
command on its own to analyze a file and show the various sub-streams:
$ aufmt your_file.mkv
your_file.mkv:
* v:0 hevc jpn [default]
* a:0 ac3 eng fltp (6) [5.1(side)] [default]
* a:1 ac3 eng fltp (2) [stereo]
* a:2 ac3 jpn fltp (6) [5.1(side)]
* s:0 subrip eng [forced]
* s:1 subrip eng
Re-encoding files
Re-encode your media based on rules defined in the ~/.aufmt.js
config file. See the config/example.js
for an example of how this config file should be defined.
Basic Transcoding
It is recommended to use the -d
option initially to perform a dry-run. This will display the stream transformations without performing any re-encoding:
$ aufmt recode -d your_file.mkv
When you are satisfied, remove the -d
option to perform transcoding (if needed).
By default, aufmt
will output the file using a temporary suffix. For example, the file your_file.mkv
will be transcoded to a file following the pattern your_file.XXXXXX.tmp.mkv
.
If you would like aufmt
to replace the original file when transcoding is finished, use the -r
option:
$ aufmt recode -r your_file.mkv`
Please use this carefully as it is destructive and can result in data loss.
Find more details using the aufmt recode --help
command.
Stream mapping
By default, all streams will be copied or transcoded into the output file. You can select or deselect specific streams using the -m
(map) option. For example:
$ aufmt recode your_file -m v:0,a:1,sn
This will select the first video stream (v:0
), the second audio stream (a:0
), and will de-select all subtitle streams (sn
). This syntax is designed to mirror ffmpeg
's -map
option.
Reordering streams is not currently possible, please use a post-processing tool like mkvmerge
if you need to manipulate streams in a more complex way.
Additional options
Additional options can be passed to the ffmpeg
backend using a variety of ways:
- Presets: Use
-p
to specify a named rule preset to apply (defined in your config file), instead of using the default preset defined in the configuration file. - Option Groups: Use
-o
to specify a named option group (defined in your config file) to be included with theffmpeg
command. - Inline Options: Use
-v
,-a
, and-s
to specify additional video, audio, and subtitle encoder options inline, as needed.
When using complex transcoding configurations it is highly recommended to use the -d
option for a dry-run to preview the ffmpeg
options before performing a transcode.