-
Notifications
You must be signed in to change notification settings - Fork 25
Trim Configuration
The first text box in the trim configuration window contains the trim
prefix. The prefix is the directory that Aegisub-Motion tries to write
the output video to. The default value is ?video
, which evaluates to
the same directory the video that is loaded in Aegisub is in.
If, for example, you have several episodes of a show in the same folder,
and you want to store all of your motion tracking clips in a folder
named Tracking Clips
in the same folder, giving you a structure like:
Episodes/
|- Episode 01.mkv
|- Episode 02.mkv
|- Episode 03.mkv
`- Tracking Clips/
|- Episode 01[10-33].mp4
|- Episode 01[9501-9553].mp4
`- Episode 02[15190-15254].mp4
Then you would probably want to set your prefix to ?video/Tracking Clips
. Note that there is no trailing /
at the end of the prefix. All
paths have /
converted to \
on Windows, so there is no real need to
worry about which type of directory separator you are using.
Any path specifier is valid in the prefix, though most of
them don't make sense. The most interesting ones are ?script
, ?video
and ?audio
, which correspond to the directories the script, loaded
video and loaded audio are in, respectively.
The checkbox directly below the prefix box, Try to create prefix directory
, tells the trim handler whether or not it should try to
create the prefix directory if it does not exist. This feature is handy
if you have your prefix set up in a way that a new one must be created
frequently, and in theory will ensure that the prefix directory exists.
However, it is disabled by default, as it may be possible to produce
confusing or mysterious results.
There are currently two available presets:
-
x264
(default) ffmpeg
These are encoding command templates that can be used easily, out of the box. The x264 encoding command is recommended due to its accuracy, speed and compatibility. However, if you use Mocha Pro, you must have QuickTime (or QuickTime Lite) installed to be able to decode the h264 streams that x264 produces.
Therefore, for people who are unwilling or unable to install QuickTime, the ffmpeg preset is available. It produces a sequence of numbered images that can be loaded in Mocha Pro without the need of any extra software. However, it is potentially slower, and it may not always trim the section frame-accurately.
Obviously, the x264
preset requires the user to have an x264
binary,
and the ffmpeg
preset requires the user to have an ffmpeg
binary.
To be able to trim videos, Aegisub-Motion must know where the encoding
binary you want to use is stored. The full path to the file is required.
If this is an empty value, the configuration window will pop up when the
Trim
or Trim Each
macros are run.
No processing is done on the binary path, so it should be a full path pointing to a valid executable file. If the executable is in the system PATH environment, then writing the full file path is unnecessary but still recommended.
Aegisub-Motion encodes the video by generating a shell script and then executing the shell script. It uses a system of tokens to allow flexible encoding commands to be written. If there is a custom encoding command present, it will override the current preset.
The shell script is written to ?temp/a-mo.encode.(sh|bat)
. ?temp
is
a path specifier provided by Aegisub. On windows, a log file is written
to ?temp/a-mo.encode.log
. The standard output and standard error of
the last line of the encoding command are directed into the log file,
and its contents are displayed in the log window if the encoding command
returns an error code.
Token Name | Description | Source |
---|---|---|
encbin |
Encoder binary path, from config. | trim.encbin |
input |
The filename of the video currently open in Aegisub. | project_properties |
inpath |
The full path to the directory containing the currently open video file. | ?video |
prefix |
Output prefix, from config. | trim.prefix |
index |
input , with extension stripped (for FFMS2 index files). |
input |
output |
Alias of index (for output file). |
index |
startf |
The start frame of the selected video segment. | line times |
endf |
The end frame of the selected video segment. | line times |
lenf |
The length of the selected video segement, in frames. | line times |
startt |
The start time of the selected video segment, in seconds. | line times |
endt |
The end time of the selected video segment, in seconds. | line times |
lent |
The length of the selected video segment, in seconds. | line times |
temp |
Temporary directory to write files to. | ?temp |
The presets are examples of how to write your own encode command.
x264:
'"#{encbin}" --crf 16 --tune fastdecode -i 250 --fps 23.976 --sar 1:1 --index "#{prefix}/#{index}.index" --seek #{startf} --frames #{lenf} -o "#{prefix}/#{output}[#{startf}-#{endf}].mp4" "#{inpath}/#{input}"'
ffmpeg:
'"#{encbin}" -ss #{startt} -sn -i "#{inpath}/#{input}" -vframes #{lenf} "#{prefix}/#{output}[#{startf}-#{endf}]-%05d.jpg"'
Note (20-02-2019)
The above example for the ffmpeg command will fail (on Windows). Removing the single quotes resolves the issue.