Browse Source

Merge pull request #26 from chapmanjacobd/cli-duration

default clip duration
pull/31/head
Mikael Finstad 6 years ago
committed by GitHub
parent
commit
1c07a9d4ad
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 6
      cli.js

2
README.md

@ -145,7 +145,7 @@ Edit specs are Javascript / JSON objects describing the whole edit operation wit
| `fast` | `--fast`, `-f` | Fast mode (low resolution and FPS, useful for getting a quick preview) | `false` | |
| `defaults.layer.fontPath` | `--font-path` | Set default font to a .ttf | System font | |
| `defaults.layer.*` | | Set any layer parameter that all layers will inherit | | |
| `defaults.duration` | | Set default clip duration for clips that don't have an own duration | `4` | sec |
| `defaults.duration` | `--clip-duration` | Set default clip duration for clips that don't have an own duration | `4` | sec |
| `defaults.transition` | | An object `{ name, duration }` describing the default transition. Set to **null** to disable transitions | | |
| `defaults.transition.duration` | `--transition-duration` | Default transition duration | `0.5` | sec |
| `defaults.transition.name` | `--transition-name` | Default transition type. See **Transition types** | `random` | |

6
cli.js

@ -26,6 +26,7 @@ const cli = meow(`
--json Use JSON edit spec
--transition-name Name of default transition to use (default: random)
--transition-duration Default transition duration
--clip-duration Default clip duration
--width Width which all media will be converted to
--height Height which all media will be converted to
--fps FPS which all videos will be converted to
@ -46,6 +47,7 @@ const cli = meow(`
verbose: { type: 'boolean', alias: 'v' },
fast: { type: 'boolean', alias: 'f' },
transitionDuration: { type: 'number' },
clipDuration: { type: 'number' },
width: { type: 'number' },
height: { type: 'number' },
fps: { type: 'number' },
@ -90,7 +92,7 @@ const cli = meow(`
params.clips = clips.map((clip) => ({ layers: [clip] }));
}
const { verbose, transitionName, transitionDuration, width, height, fps, audioFilePath, fontPath, fast, out: outPath } = cli.flags;
const { verbose, transitionName, transitionDuration, clipDuration, width, height, fps, audioFilePath, fontPath, fast, out: outPath } = cli.flags;
if (transitionName || transitionDuration != null) {
params.defaults.transition = {};
@ -98,6 +100,8 @@ const cli = meow(`
if (transitionDuration) params.defaults.transition.duration = transitionDuration;
}
if (clipDuration) params.defaults.duration = clipDuration;
if (fontPath) {
params.defaults.layer = {
fontPath,

Loading…
Cancel
Save