jvc
ScriptThe bin/jvc
script is the primary way to transform video assets with JVC.
There are other scripts in bin
that perform a single operation using
command-line arguments. If you need to do a quick operation and don’t want to write
a JVC spec, use one of these tools.
For example, to extract the first 5 seconds of a video:
jtrim /tmp/input-file.mp4 /tmp/output-5s.mp4 0 5
All commands accept a -h
/ --help
option, use this to print usage information:
jscale -h
A JVC spec is just a regular JSON file that happens to contain a single JSON object,
whose properties are assets
and operations
.
When you run jvc
on a spec file, it will load the assets
, then perform the operations
in order.
Learn more about Assets and Operations
Unlike most JSON, comments are allowed in JVC spec files:
//
and continue to the end of the line/*
and ends with */
The easiest way to write a spec is to copy one of the test specs and edit it.
There examples for every JVC operation.
To execute a spec stored in the file my-spec.json
, you would run:
jvc my-spec.jvc
or use stdin:
cat my-spec.jvc | jvc
Output assets will be placed in the scratch directory, unless otherwise specified
in the spec file. By default, JVC will create a new temporary directory to use as the scratch
directory. You can set the scratch directory explicitly using the -t
or --temp-dir
option:
jvc -t /some/tempdir my-spec.json
When using the other tools in bin
, you can set the scratch directory via the
JVC_SCRATCH_DIR
environment variable. If the JVC_SCRATCH_DIR
references a
directory that does not exist, it will be created.
Use the -n
or --no-exec
option to print out the commands that would have been run,
but do not actually run anything.
jvc -n my-spec.json # will not run any ffmpeg commands
Note that this breaks JVC operations that require information from any assets created by previous operations: since the command did not actually run, the intermediate asset was never created.
When using the other tools in bin
, you can set the “no exec” flag via the
JVC_NO_EXEC
environment variable. If the JVC_NO_EXEC
is non-empty, then
the script will pass the -n
flag when it calls jvc
and commands will
be printed out instead of actually being run.
To view a list of all jvc
command-line options, run jvc -h
or jvc --help
Learn about Assets and Operations, the core concepts of JVC.