Skip to content

Commit

Permalink
additional fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Feb 7, 2019
1 parent 92c743d commit 9f9d735
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Submitting this data to the binary will result in start of the rendering process
$ nexrender-cli '{"template":{"src":"file:///d:/documents/myproject.aep","composition":"main"}}'
```

or more conveniently using `--file` option
or more conveniently using the `--file` option

```sh
$ nexrender-cli --file myjob.json
Expand Down Expand Up @@ -192,7 +192,7 @@ There are multiple built-in modules within nexrender ecosystem:
Every module might have his own set of fields, however, `module` field is always there.

Also, you might've noticed that `actions` is an object, however, we described only one (`postrender`) field in it.
And there is one more, its called `prerender`. The latter one can be used to process data/assets just before the actual render will start.
And there is one more, its called `prerender`. The latter can be used to process data/assets just before the actual render will start.

Also, if you are planning on having more than one action, please note: **actions are order-sensitive**,
that means if you put let's say some encoding action after upload, the latter one might not be able to find a file that needs to be generated by former one,
Expand Down Expand Up @@ -293,9 +293,9 @@ More info: [@nexrender/core](packages/nexrender-core)

# Template rendering

One of main benefits of using nexrender is an ability to render projects using data other than what have been used while project has been created.
One of the main benefits of using nexrender is an ability to render projects using data other than what has been used while the project has been created.
Data means any sort of source/footage material, it can be images, audio tracks, video clips, text strings, values for colors/positions, even dynamic animations using expressions.
All of those things can be replaced for every job without even opening project file or starting After Effects.
All of those things can be replaced for every job without even opening a project file or starting After Effects.

> Note: Also this process can be called in other ways: **templated**, **data-driven** or **dynamic** video generation.
Expand All @@ -304,22 +304,21 @@ However, what is needed to get started?

## Footage items

Footage item replacement is what breifly has been covered in `Job` section of this document.
The idea is quite simple, you describe which asset will replace existing described footage item in specific layer,
Footage item replacement is what briefly has been covered in the `Job` section of this document.
The idea is quite simple, you describe which asset will replace existing described footage item in a specific layer,
by specifying `src`, and one of the `layerName` or `layerIndex` options.

### Fields

* `src`: string, a URI pointer to the specific resource, check out [supported protocols](#protocols)
* `type`: string, for footage items is one of (`image`, `audio`, `video`)
* `type`: string, for footage items, is one of (`image`, `audio`, `video`)
* `layerName`: string, target layer name in the After Effects project
* `layerIndex`: integer, additonally instead of `layerName` you can select layer by providing an index
of the layer instead of maching by name starting from 1 (default behavior of AE jsx scripting env)
* `layerIndex`: integer, can be used instead of `layerName` to select a layer by providing an index, starting from 1 (default behavior of AE jsx scripting env)

Specified asset from `src` field will be downloaded/copied to the working directory, and just before rendering will happen,
fotage item with specified `layerName` or `layerIndex` in the original project will be replaced with the freshly downloaded asset.
a fotage item with specified `layerName` or `layerIndex` in the original project will be replaced with the freshly downloaded asset.

This way you (if you are using network rendering) you can not only deliver assets to the target platform, but also dynamically replace them.
This way you (if you are using network rendering) you can not only deliver assets to the target platform but also dynamically replace them.

### Example

Expand All @@ -342,17 +341,16 @@ This way you (if you are using network rendering) you can not only deliver asset

## Data items

Second important point for the dynamic data-driven video generation is ability to replace/change/modify non-footage data in the project.
The second important point for the dynamic data-driven video generation is the ability to replace/change/modify non-footage data in the project.
To do that a special asset of type `data` can be used.

### Fields

* `type`: string, for data items is always `data`
* `type`: string, for data items, is always `data`
* `layerName`: string, target layer name in the After Effects project
* `layerIndex`: integer, additonally instead of `layerName` you can select layer by providing an index
of the layer instead of maching by name starting from 1 (default behavior of AE jsx scripting env)
* `layerIndex`: integer, can be used instead of `layerName` to select a layer by providing an index, starting from 1 (default behavior of AE jsx scripting env)
* `property`: string, indicates which layer property you want to change
* `value`: mixed, optional, indicates which value you want set to specified property
* `value`: mixed, optional, indicates which value you want to be set to a specified property
* `expression`: string, optional, allows you to specify an expression that can be executed every frame to calculate the value

Since both `value` and `expression` are optional you can provide them in any combination, depending on the effect you want to achieve.
Expand All @@ -365,7 +363,7 @@ And if you are not sure what is a `property` and where to get it you can refer t
<details>
<summary><b>Property List Example</b></summary>

>As you can see there are a few `Property Groups` like Text, Masks, Transform that include actual properties. Those properties is what can be used as target.
>As you can see there are a few `Property Groups` like Text, Masks, Transform that include actual properties. Those properties are what can be used as a target.
![](https://user-images.githubusercontent.com/2182108/52443468-7270dd00-2b2e-11e9-8336-255349279c43.png)

Expand Down Expand Up @@ -399,21 +397,21 @@ And if you are not sure what is a `property` and where to get it you can refer t
}
```

>Note: any error in expression will prevent project from rendering. Make sure to read error messages reported by After Effects binary carefuly.
>Note: any error in expression will prevent the project from rendering. Make sure to read error messages reported by After Effects binary carefully.
## Script items

The last and the most complex and yet the most powerful, is an ability to execute custom `jsx` scripts just before the rendering will start.
This approach allows you to do pretty much anyhting that is allowed for scripting,
like creating/removing layers, adding new elements, restructuring whole composition, and probably much more.
The last and the most complex and yet the most powerful is an ability to execute custom `jsx` scripts just before the rendering will start.
This approach allows you to do pretty much anything that is allowed for scripting,
like creating/removing layers, adding new elements, restructuring the whole composition, and probably much more.

Now, actual complexity happens only from the side of actual scripting, you need to have some basic knowledge of `ExtendScript Toolkit`,
and from the nexrender side everything is quite simple. You only need to provide an `src` pointing towards script resource, and setup proper type.
and from the nexrender side everything is quite simple. You only need to provide an `src` pointing towards script resource and set up proper type.

### Fields

* `src`: string, a URI pointer to the specific resource, check out [supported protocols](#protocols)
* `type`: string, for script items is always `script`
* `type`: string, for script items, is always `script`

### Example

Expand Down Expand Up @@ -568,22 +566,30 @@ And of course, the main thing about development is that it should be fun. :)
`src` field is a URI string, that describes path pointing to the specific resource. It supports a few different protocols:

* Built-in:
* `file://`
* `http://`
* `https://`
* `data://`
* `file://` - file on a local file system, (possibly a pipe? need testing)
* `http://` - file on remote http server
* `https://` - file on remote http server served via https
* `data://` - URI encoded data, can be a [base64 or plain text](https://en.wikipedia.org/wiki/Data_URI_scheme)

* External:
* `s3://` - [@nexrender/provider-s3](packages/nexrender-provider-s3)
* `s3://` - [@nexrender/provider-s3](packages/nexrender-provider-s3) - Amazon S3 provider
* `ftp://` - [@nexrender/provider-ftp](packages/nexrender-provider-ftp) - TODO
* (other procotocols will be added there)

## Examples

Here are some examples of src paths:

```
file:///home/assets/image.jpg
file://d:/projects/project.aep
http://somehost.com:8080/assets/image.jpg?key=foobar
https://123.123.123.123/video.mp4
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
data:text/plain;charset=UTF-8,some%20data:1234,5678
```

# External Packages
Expand Down

0 comments on commit 9f9d735

Please sign in to comment.