Skip to content

Commit b41e2c9

Browse files
committed
Updated README.md
Signed-off-by: Andrew Welch <andrew@nystudio107.com>
1 parent 9fe9f19 commit b41e2c9

File tree

1 file changed

+79
-2
lines changed

1 file changed

+79
-2
lines changed

README.md

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Transcode video & audio files to various formats, and provide video thumbnails
88

99
Related: [Transcoder for Craft 2.x](https://github.com/nystudio107/transcoder)
1010

11-
**Note**: _This plugin will costs $59.00 and is available in the Craft CMS 3 plugin store._
11+
**Note**: _This plugin costs $59.00 and is available in the Craft CMS 3 plugin store._
1212

1313
## Requirements
1414

@@ -36,7 +36,7 @@ If you have managed hosting, contact your sysadmin to get `ffmpeg` installed.
3636

3737
## Transcoder Overview
3838

39-
The Transcoder plugin allows you to transcode any video (local or remote) to any size, bitrate, framerate, and save it out as a web-ready video in a variety of file formats.
39+
The Transcoder plugin allows you to transcode any video or animated gif (local or remote) to any size, bitrate, framerate, and save it out as a web-ready video in a variety of file formats.
4040

4141
It can also transcode audio files to any bitrate & sample rate, to a variety of file formats. It can even extract audio tracks from video files.
4242

@@ -181,6 +181,83 @@ The above example would cause it to not change the audio of the source audio fil
181181

182182
The file format setting `audioEncoder` is preset to what you'll need to generate `mp3` audio files, but it can also generate `aac`, `ogg`, or any other format that `ffmpeg` supports. See the `config.php` file for details
183183

184+
### Generating a Transcoded Video
185+
186+
To generate a transcoded video, do the following:
187+
188+
{% set transVideoUrl = craft.transcoder.getVideoUrl('/home/vagrant/sites/nystudio107/public/oceans.mp4', {
189+
"videoFrameRate": 20,
190+
"videoBitRate": "500k",
191+
"width": 720,
192+
"height": 480
193+
}) %}
194+
195+
You can also pass in an URL:
196+
197+
{% set transVideoUrl = craft.transcoder.getVideoUrl('http://vjs.zencdn.net/v/oceans.mp4', {
198+
"videoFrameRate": 20,
199+
"videoBitRate": "500k",
200+
"width": 720,
201+
"height": 480
202+
}) %}
203+
204+
You can also pass in an `Asset`:
205+
206+
{% set myAsset = entry.someAsset.first() %}
207+
{% set transVideoUrl = craft.transcoder.getVideoUrl(myAsset, {
208+
"videoFrameRate": 20,
209+
"videoBitRate": "500k",
210+
"width": 720,
211+
"height": 480
212+
}) %}
213+
214+
It will return to you a URL to the transcoded video if it already exists, or if it doesn't exist, it will return `""` and kick off the transcoding process (which can be quite lengthy for long videos).
215+
216+
In the array you pass in, the default values are used if the key/value pair does not exist:
217+
218+
{
219+
"videoEncoder" => "h264",
220+
"videoBitRate" => "800k",
221+
"videoFrameRate" => 15,
222+
"aspectRatio" => "letterbox",
223+
"sharpen" => true,
224+
}
225+
226+
These default values come from the `config.php` file.
227+
228+
If you want to have the Transcoder not change a parameter, pass in an empty value in the key/value pair, e.g.:
229+
230+
{% set transVideoUrl = craft.transcoder.getVideoUrl('/home/vagrant/sites/nystudio107/public/oceans.mp4', {
231+
"frameRate": "",
232+
"bitRate": ""
233+
}) %}
234+
235+
The above example would cause it to not change the frameRate or bitRate of the source video (not recommended for client-proofing purposes).
236+
237+
The `aspectRatio` parameter lets you control how the video aspect ratio is maintained when it is scaled:
238+
239+
`none` results in the aspect ratio of the original video not being maintained, and the video scaled to the dimensions passed in:
240+
241+
![Screenshot](resources/screenshots/oceans_20s_300w_200h_none.jpg)
242+
243+
`crop` scales the video up to maintain the original aspect ratio, and then crops it so that it's full-frame:
244+
245+
![Screenshot](resources/screenshots/oceans_20s_300w_200h_crop.jpg)
246+
247+
`letterbox` scales the video to fit the new frame, putting a letterboxed or pillarboxed border to pad it:
248+
249+
![Screenshot](resources/screenshots/oceans_20s_300w_200h_letterbox.jpg)
250+
251+
You can control the color of the letterboxed area (it's `black` by default) via the `letterboxColor` option. It can be either a semantic color name, or a hexcode color, e.g.: `0xC0C0C0`
252+
253+
The `sharpen` option determines whether an unsharp mask filter should be applied to the scaled video.
254+
255+
The file format setting `videoEncoder` is preset to what you'll need to generate `h264` videos, but it can also generate `webm` videos, or any other format that `ffmpeg` supports. See the `config.php` file for details
256+
257+
![Screenshot](resources/screenshots/admin-cp-video-thumbnails.png)
258+
259+
Transcoder will also automatically add video thumbnails in the AdminCP Asset index.
260+
184261
### Getting Transcoding Progress
185262

186263
Transcoding of video/audio files can take quite a bit of time, so Transcoder provides you with a way to get the status of any currently running transcoding operation via `craft.transcoder.getVideoProgressUrl()` or `craft.transcoder.getAudioProgressUrl()`. For example:

0 commit comments

Comments
 (0)