Skip to content

Commit

Permalink
Update documentation to reflect adding Image transcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
koxon committed Jan 15, 2016
1 parent 6be6437 commit d3842c2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 20 deletions.
2 changes: 1 addition & 1 deletion _posts/2015-07-09-basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ php ClientCommander.php -c clientConfig.json
Command [enter]: start_job input_samples/input_video.json
```

It will send an SQS message to the InputPoller that will start a new workflow for you. You should your ValidateAsset ActivityPoller do some work. Then it will be the TranscodeAsset ActivityPoller that will start after the first task is over.
It will send an SQS message to the InputPoller that will start a new workflow for you. You should see your ValidateAsset ActivityPoller do some work. Look at the log file by default located in `/var/tmp/logs/cpe/`. Then the TranscodeAsset ActivityPoller will start once the first task is over.


<br>
Expand Down
4 changes: 2 additions & 2 deletions _posts/2015-07-13-activities.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The expected JSON payload your Decider must pass as input to this activity is as

**Those are the minimum fields this activity should receive:**

- [**input_asset**](/CloudTranscode/specs/input.html): Contains the basic information about your input asset.
- [**input_asset**](/CloudTranscode/specs/input.html): Contains the basic information about your input asset. The ValidateAsset activity only supports the `buket/file` input parameters. It doesn't support `http`.
- **client**: The client is injected in your workflow input paylad by the InputPoller. **You must pass it to all your activities.** See for example: http://sportarchive.github.io/CloudProcessingEngine/comp/decider.html#decider-plan

**This activity should always be first in a workflow for two reasons:**
Expand Down Expand Up @@ -79,7 +79,7 @@ The expected JSON payload your Decider must pass as input to this activity is as

- [**input_asset**](/CloudTranscode/specs/input.html): Contains the basic information about your input asset.
- **client**: The client is injected in your client application payload by the InputPoller. You must pass it to your activities. See for example: http://sportarchive.github.io/CloudProcessingEngine/comp/decider.html#decider-plan
- **input_asset_metadata**: Output of FFprobe that describe the input asset. This can be capture in your decider plan after the ValidateAsset acitivty and passed on to the TranscodeActivity. See the ct_plan_simple.xml in the Decider project (docs/examples/).
- **input_asset_metadata**: Metadata that will be passed along to the Transcoder. For Videos, pass the output of FFprobe that describe the input asset. This can be capture in your decider plan after the ValidateAsset acitivty and passed on to the TranscodeActivity. See the ct_plan_simple.xml in the Decider project (docs/examples/).
- [**output_asset**](/CloudTranscode/specs/output.html): Information about what type of resulting file we want. What do you want to transcode?

Now you have the information you need to start your own job. Check the specs in the documentation to know the options you have at your disposal to transcode the files you want.
Expand Down
8 changes: 6 additions & 2 deletions _posts/2015-07-13-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ To reference a file located on AWS S3, use the following format:

**Details:**

- **type**: VIDEO (no other types are yet supported)
- **type**: VIDEO or IMAGE (no other types are yet supported)
- **bucket**: S3 bucket name
- **file**: S3 key to file in bucket

> You must provide this entry to all activities so they know which asset they need to download from S3 and process.
Based on the `type' the proper Transcoder will be started for you: ImageTranscoder or VideoTranscoder.

### HTTP/HTTPS file

To reference a file over HTTP use the following format:
Expand All @@ -42,4 +44,6 @@ To reference a file over HTTP use the following format:
}
```

This is a very efficient way of probing, creating thumbnails or transcoding videos. No need to pre-download the asset locally in the /tmp folder. FFmpeg will download the file and transcode on the fly for you. You will save precious time.
This is a very efficient of transcoding videos. With this method, there is no need to pre-download the asset locally in the /tmp folder. FFmpeg will download the file and transcode on the fly for you. You will save precious time.

> This only works for the VIDEO type as FFMpeg supports the HTTP protocol. For IMAGE type, you must specify a bucket and key.
63 changes: 48 additions & 15 deletions _posts/2015-07-13-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Here we describe the type of output you can generate with CT. We describe the JS

2. [Video output](#video-output)

Use this syntax to transcode a video to another video
Use this syntax to transcode a video to another video. We use `ffmpeg` command for this.

2. [Presets](#presets)

Expand All @@ -28,7 +28,11 @@ Here we describe the type of output you can generate with CT. We describe the JS

3. [Thumbnails output](#thumbnail-output)

Use these options to output thumbnails from a video
Use these options to output thumbnails from a video. We use `ffmpeg` command for this.

3. [Image output](#image-output)

Use these options to output an image from another image. image to image transcoding. We use `convert` command for this.


### Common attributes
Expand All @@ -53,7 +57,7 @@ The output_type field is dependent on the input_type field. You cannot convert a

key | type | default | mandatory | description | values
--- | ---- | ------- | --------- | ----------- | ------
type | string | none | yes | Type of the file to ouput | VIDEO, THUMB
type | string | none | yes | Type of the file to ouput | VIDEO, THUMB, IMAGE
bucket | string | none | yes | S3 bucket where the ouput file will be uploaded | any
file | string | none | yes | Path and filename of the file to generate and upload | any
s3_rrs | string | false | no | Activate Reduced redundancy or not in S3 storage | true, false
Expand Down Expand Up @@ -125,7 +129,7 @@ watermark | object | none | no | Describe watermark for the video | see <a href=
keep_ratio | boolean | true | no | Keep the ratio of the original video. 4:3 or 16:9 | true,false
no_enlarge | boolean | true | no | Prevent enlarging the video size from original, even if bigger size is provided. | true,false

### Presets
#### Presets
```json
{
"name": "System preset: Generic Apple TV 3G",
Expand Down Expand Up @@ -159,17 +163,7 @@ video_codec_options | string | no | no | Codec options such as: "MaxReferenceFra

A list of pre-made presets can be found in the CT project and here: https://github.com/sportarchive/CloudTranscode-FFMpeg-presets

### Custom command

You can craft your own custom command and CT will execute it for you. In order to reference the input file, watermark options and the wanted output file, three keywords are available to use in your command line. Those keywords will be automatically replaced by CT at runtime by the proper value.

* `${input_file}` : Will be replaced by the location on the local filesystem of your input file specified in the `input_asset` section. The file referenced in the `input_asset` section is downloaded on the local disk in /tmp.
* `${watermark_options}` : This will be replaced by the proper options to overlay a watermark on your video. Just specify a `watermark` section in the `output_asset` section (see below for details) and CT will add the proper options and will download the image for you.
* `${output_file}` : This will be replaced by the location and name of the wanted file. It will be located in /tmp. The resulting file will be uploaded for you to the desired S3 location.

For an example, see the `client_example/input_samples` folder in the CPE project. There are example JSON files there that illustrate the different options you have.

### Watermark
#### Watermark

```json
...
Expand Down Expand Up @@ -246,4 +240,43 @@ intervals |integer |10 |no |Override default interval in seconds. |any
snapshot_sec |interger |0 |no |Second in the video when to take the snapshot |any
size | string |none |yes |Size of the thumbnails | x:y. **Use -1 on x OR y, to provide no value and keep ratio**

### Image Output
> Generates an image from another image.

```json
{
...
"output": {
"type": "IMAGE",
"bucket": "ClientA-bucket-out",
"file": "/output1/images/image.*",
"s3_rrs": true,
"s3_encrypt": true,
"resize": "180x180",
"quality": 70,
"crop": "600x600+0+0"
}
}
```

These are the output attributes you must provide to generate a new image from another image.

key | type | default | mandatory | description | values
--- | ---- | ------- | --------- | ----------- | ------
bucket |string |none |yes |S3 bucket and path where the ouput image will be uploaded |any
file |string |none |yes |filename for your new image. The extension can be `.*` to retain the source file extention. Or you can specify anothe extension to transform the file. JPEG to PNG for example |any
resize | string |none |no |Resize the output image to the desired size |/\d+x\d+/
crop |string |none |no |Crop the source image to the desired size and coordinate. |Follow `convert` option specs: http://www.imagemagick.org/Usage/crop/
quality |integer |none |no |Set the quality of the output image. |0-100. 100 being the best quality. Refer to: http://www.imagemagick.org/script/command-line-options.php#quality

### Custom command

Both VIDEO and IMAGE transcoding can accept a custom command so you can run the command you want even if it's not support by the default JSON format.

You can craft your own custom command and CT will execute it for you. In order to reference the input file, watermark options and the wanted output file, three keywords are available to use in your command line. Those keywords will be automatically replaced by CT at runtime by the proper value.

* `${input_file}` : Will be replaced by the location on the local filesystem of your input file specified in the `input_asset` section. The file referenced in the `input_asset` section is downloaded on the local disk in /tmp.
* `${watermark_options}` : Only usable for VIDEO output. This will be replaced by the proper options to overlay a watermark on your video. Just specify a `watermark` section in the `output_asset` section (see below for details) and CT will add the proper options and will download the image for you.
* `${output_file}` : This will be replaced by the location and name of the wanted file. It will be located in /tmp. The resulting file will be uploaded for you to the desired S3 location.

For examples, see the `client_example/input_samples` folder in the CPE project. There are example JSON files there that illustrate the different options you have.

0 comments on commit d3842c2

Please sign in to comment.