Skip to content

Commit 28bb939

Browse files
committed
Merge branch 'release/1.2.9' into v1
2 parents 151c609 + 8d9985d commit 28bb939

File tree

4 files changed

+10
-79
lines changed

4 files changed

+10
-79
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Transcoder Changelog
22

3+
## 1.2.9 - 2020.01.27
4+
### Fixed
5+
* Fixed an issue if `ffprobe` isn't installed
6+
* Handle the case of empty or malformed status data from `ffprobe` better
7+
38
## 1.2.8 - 2019.11.12
49
### Changed
510
* Fixed more issues with the `synchronous` option

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nystudio107/craft-transcoder",
33
"description": "Transcode video & audio files to various formats, and provide video thumbnails",
44
"type": "craft-plugin",
5-
"version": "1.2.8",
5+
"version": "1.2.9",
66
"keywords": [
77
"craft",
88
"cms",

docs/docs/Using.md

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -131,83 +131,6 @@ The above example would cause it to not change the audio of the source audio fil
131131

132132
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
133133

134-
## Generating a Transcoded Video
135-
136-
To generate a transcoded video, do the following:
137-
138-
{% set transVideoUrl = craft.transcoder.getVideoUrl('/home/vagrant/sites/nystudio107/public/oceans.mp4', {
139-
"videoFrameRate": 20,
140-
"videoBitRate": "500k",
141-
"width": 720,
142-
"height": 480
143-
}) %}
144-
145-
You can also pass in an URL:
146-
147-
{% set transVideoUrl = craft.transcoder.getVideoUrl('http://vjs.zencdn.net/v/oceans.mp4', {
148-
"videoFrameRate": 20,
149-
"videoBitRate": "500k",
150-
"width": 720,
151-
"height": 480
152-
}) %}
153-
154-
You can also pass in an `Asset`:
155-
156-
{% set myAsset = entry.someAsset.one() %}
157-
{% set transVideoUrl = craft.transcoder.getVideoUrl(myAsset, {
158-
"videoFrameRate": 20,
159-
"videoBitRate": "500k",
160-
"width": 720,
161-
"height": 480
162-
}) %}
163-
164-
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).
165-
166-
In the array you pass in, the default values are used if the key/value pair does not exist:
167-
168-
{
169-
"videoEncoder" => "h264",
170-
"videoBitRate" => "800k",
171-
"videoFrameRate" => 15,
172-
"aspectRatio" => "letterbox",
173-
"sharpen" => true,
174-
}
175-
176-
These default values come from the `config.php` file.
177-
178-
If you want to have the Transcoder not change a parameter, pass in an empty value in the key/value pair, e.g.:
179-
180-
{% set transVideoUrl = craft.transcoder.getVideoUrl('/home/vagrant/sites/nystudio107/public/oceans.mp4', {
181-
"frameRate": "",
182-
"bitRate": ""
183-
}) %}
184-
185-
The above example would cause it to not change the frameRate or bitRate of the source video (not recommended for client-proofing purposes).
186-
187-
The `aspectRatio` parameter lets you control how the video aspect ratio is maintained when it is scaled:
188-
189-
`none` results in the aspect ratio of the original video not being maintained, and the video scaled to the dimensions passed in:
190-
191-
![Screenshot](./resources/screenshots/oceans_20s_300w_200h_none.jpg)
192-
193-
`crop` scales the video up to maintain the original aspect ratio, and then crops it so that it's full-frame:
194-
195-
![Screenshot](./resources/screenshots/oceans_20s_300w_200h_crop.jpg)
196-
197-
`letterbox` scales the video to fit the new frame, putting a letterboxed or pillarboxed border to pad it:
198-
199-
![Screenshot](./resources/screenshots/oceans_20s_300w_200h_letterbox.jpg)
200-
201-
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`
202-
203-
The `sharpen` option determines whether an unsharp mask filter should be applied to the scaled video.
204-
205-
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
206-
207-
![Screenshot](./resources/screenshots/admin-cp-video-thumbnails.png)
208-
209-
Transcoder will also automatically add video thumbnails in the Control Panel Asset index.
210-
211134
## Getting Transcoding Progress
212135

213136
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:

src/services/Transcode.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,10 @@ public function getFileInfo($filePath, $summary = false)
467467
Craft::info($ffprobeCmd, __METHOD__);
468468
$result = JsonHelper::decodeIfJson($shellOutput, true);
469469
Craft::info(print_r($result, true), __METHOD__);
470-
470+
// Handle the case it not being JSON
471+
if (!is_array($result)) {
472+
$result = [];
473+
}
471474
// Trim down the arrays to just a summary
472475
if ($summary && !empty($result)) {
473476
$summaryResult = [];

0 commit comments

Comments
 (0)