Skip to content

Commit 71f0e39

Browse files
committed
Addressed review notes, fixed formatting & relative links.
Signed-off-by: Joshua Minor <joshm@pixar.com>
1 parent 2da24d2 commit 71f0e39

File tree

1 file changed

+71
-16
lines changed

1 file changed

+71
-16
lines changed

docs/tutorials/otiotool.md

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
`otiotool` is included with several other command line utilities as part of the
88
OpenTimelineIO Python module. You can install it via typical Python utilities
9-
like `pip`, etc.
9+
like `pip`, etc. See [Quickstart](./quickstart#install-otio]) for details.
1010

11-
If you don't already have that module installed, but you do have
11+
[!NOTE] If you have
1212
[uv installed](https://docs.astral.sh/uv/), then you can use `otiotool` with
13-
this handy shortcut:
13+
this handy shortcut without having to deal with any installation:
1414

1515
```bash
1616
uvx --from opentimelineio otiotool
@@ -20,12 +20,20 @@ uvx --from opentimelineio otiotool
2020

2121
`otiotool` reads one or more OTIO timeline files, optionally makes changes to the timelines, and outputs a text report and/or a new OTIO file with the result.
2222

23-
To run `otiotool` for reporting, use:
23+
To run `otiotool` for reporting, use options like `--list-clips` or `--list-tracks`. The report output is
24+
printed to the console:
2425

2526
```bash
2627
otiotool --input <input_file.otio> [more inputs...] [options]
2728
```
2829

30+
Report output can be redirected from standard output
31+
to a file like any terminal program:
32+
33+
```bash
34+
otiotool --input <input_file.otio> [more inputs...] [options] > report.txt
35+
```
36+
2937
To run `otiotool` to create a new OTIO file, use:
3038

3139
```bash
@@ -34,34 +42,54 @@ otiotool --input <input_file.otio> [more inputs...] [options] --output <output_f
3442

3543
Many of `otiotool`'s command line options have a long and a short form. For example: `--input` is also `-i`, and `--output` is `-o`.
3644

45+
Multiple options of `otiotool` can be combined into
46+
a single invocation. For example, you might read a file,
47+
trim it, remove some tracks, verify missing media into
48+
a report and output a new file all in one command like this:
49+
50+
```bash
51+
otiotool -i multitrack.otio -trim 20 30 --video-only --verify-media -o output.otio > report.txt
52+
```
53+
3754
For a complete listing of all options use `otiotool -h`.
3855

3956
## Phases
4057

4158
Unlike some other command line tools, the order in which options appear on
42-
the command line does not matter. For example `otiotool -i input.otio --flatten -o output.otio` is the same as `otiotool --flatten -o output.otio -i input.otio`
59+
the command line does not matter. For example these two commands do the same thing:
60+
61+
```bash
62+
otiotool -i input.otio --flatten -o output.otio
63+
otiotool --flatten -o output.otio -i input.otio
64+
```
65+
4366
Instead, the features of this tool work in phases, as follows:
4467

4568
1. Input
69+
4670
Input files provided by the `--input <filename>` argument(s) are read into
4771
memory. Files may be OTIO format, or any format supported by adapter
4872
plugins.
4973

5074
2. Filtering
75+
5176
Options such as `--video-only`, `--audio-only`, `--only-tracks-with-name`,
5277
`--only-tracks-with-index`, `--only-clips-with-name`,
5378
`--only-clips-with-name-regex`, `--remove-transitions`, and `--trim` will remove
5479
content. Only the tracks, clips, etc. that pass all of the filtering options
5580
provided are passed to the next phase.
5681

5782
3. Combine
83+
5884
If specified, the `--stack` or `--concat` operations are
5985
performed (in that order) to combine all of the input timeline(s) into one.
6086

6187
4. Flatten
88+
6289
If `--flatten` is specified, multiple tracks are flattened into one.
6390

6491
5. Relink
92+
6593
The `--relink-by-name` option, will scan the specified folder(s) looking for
6694
files which match the name of each clip in the input timeline(s).
6795
If matching files are found, clips will be relinked to those files (using
@@ -70,17 +98,20 @@ Instead, the features of this tool work in phases, as follows:
7098
all linked media, and relink the OTIO to reference the local copies.
7199

72100
6. Remove/Redact
101+
73102
The `--remove-metadata-key` option allows you to remove a specific piece of
74103
metadata from all objects.
75104
If specified, the `--redact` option, will remove ALL metadata and rename all
76105
objects in the OTIO with generic names (e.g. "Track 1", "Clip 17", etc.)
77106

78107
7. Inspect
108+
79109
Options such as `--stats`, `--list-clips`, `--list-tracks`, `--list-media`,
80110
`--verify-media`, `--list-markers`, `--verify-ranges`, and `--inspect`
81111
will examine the OTIO and print information to standard output.
82112

83113
8. Output
114+
84115
Finally, if the `--output <filename>` option is specified, the resulting
85116
OTIO will be written to the specified file. The extension of the output
86117
filename is used to determine the format of the output (e.g. OTIO or any
@@ -143,7 +174,7 @@ otiotool -i premiere_example.otio --list-clips --only-clips-with-name "sc01_sh01
143174
otiotool -i premiere_example.otio --list-clips --only-clips-with-name-regex "sh\d+_anim"
144175
```
145176

146-
Note that `--only-clips-with-name-regex` uses the Regular Expression syntax [documented here](https://docs.python.org/3/library/re.html).
177+
Note that `--only-clips-with-name-regex` uses the [Python Regular Expression syntax](https://docs.python.org/3/library/re.html).
147178

148179
## Media Information
149180

@@ -153,7 +184,7 @@ otiotool -i multitrack.otio --list-tracks --list-clips --list-media
153184
```
154185

155186
### Verify Media Existence
156-
Checks if media files exist. Note, only local file paths are checked by `otiotool` not URLs or other non-file path media references.
187+
Checks if media files exist. Note: only local file paths are checked by `otiotool`, not URLs or other non-file path media references.
157188
```bash
158189
otiotool -i premiere_example.otio --verify-media
159190
```
@@ -191,15 +222,29 @@ TIMELINE: OTIO TEST - multitrack.Exported.01
191222
range in NestedScope (<class 'opentimelineio._otio.Stack'>): TimeRange(RationalTime(1198, 24), RationalTime(640, 24))
192223
```
193224

225+
## Input/Output
226+
227+
### Input File(s)
194228

195-
## Output File
229+
Multiple input files can be specified via `--input` like this:
230+
231+
```bash
232+
otiotool -i one.otio two.otio three.otio --concat -o result.otio
233+
```
234+
235+
[!NOTE] When `otiotool` is given multiple inputs, the order of those inputs will affect the outcome of `--concat`, `--stack`, and any text reports printed to the console.
236+
237+
### Output File
196238

197239
Modifications to the timeline(s) can be written out to a new file with the
198240
`--output <filename.otio>` option.
199241

242+
Note: The input files are never modified unless the
243+
output path specifies the same file, in which case that file will be overwritten (not recommended).
244+
200245
### Multiple Timelines
201246

202-
If the result is a single timeline, then resulting file contains that timeline
247+
If the result is a single timeline, then the output file will contain that timeline
203248
as expected. However, if there were multiple input files and those timelines
204249
were not combined with `--concat` or `--stack` then the output will be a single
205250
file containing a SerializableCollection with multiple timelines. This is a
@@ -208,20 +253,30 @@ timeline in an OTIO file.
208253

209254
### Standard In/Out
210255

211-
If you specify the `--output` file as a single `-` then the resulting OTIO will
212-
be written to as text to stdout instead of a file. You can also use `-` as an
213-
input file. This allows you to chain `otiotool` with other tools on the command
256+
You can chain `otiotool` with other tools on the command
214257
line.
215258

259+
If you specify the `--output` file as a single `-` then the resulting OTIO will
260+
be printed as text to stdout instead of a file.
261+
216262
```bash
217263
otiotool -i multitrack.otio --video-only -o - | grep MissingReference
218264
```
219265

266+
You can also use `-` as an
267+
input from stdin.
268+
269+
```bash
270+
curl https://example.com/some/path/premiere_example.otio | otiotool -i - --verify-media --stats
271+
```
272+
220273
### Format Conversion
221274

222-
The format of the output file is inferred
275+
The format of the input and output file is inferred
223276
from the filename extension. It can be `.otio` for an OTIO file, or any other
224-
file format supported by an available OTIO adapter plugin. Thus `otiotool`
277+
file format supported by an available [OTIO adapter plugin](./adapters).
278+
279+
Thus `otiotool`
225280
can operate much like `otioconvert` however some more advanced conversion
226281
options are only available in `otioconvert`. If you need both, you can write
227282
to an intermediate OTIO file and convert to/from the other format in a separate
@@ -249,7 +304,7 @@ The start and end times for `--trim` can be either a floating point number of se
249304
or timecode `HH:MM:SS:FF` in the frame rate inferred from the timeline itself.
250305

251306
### Flatten Tracks
252-
Combine tracks into one:
307+
Combine multiple tracks into one with `--flatten <TYPE>` where `TYPE` is either `video`, `audio`, or `all`:
253308
```bash
254309
otiotool -i multitrack.otio --flatten video -o output.otio --list-tracks
255310
```
@@ -285,7 +340,7 @@ When working with an application or workflow that requires an older OTIO
285340
file format, you can use `otiotool` to downgrade an OTIO to a specific schema
286341
version which is compatible.
287342

288-
See [Versioning Schemas](versioning-schemas.md) to understand this in detail.
343+
See [Versioning Schemas](./versioning-schemas) to understand this in detail.
289344

290345
```bash
291346
otiotool --list-versions

0 commit comments

Comments
 (0)