Skip to content

Commit 3d3d51e

Browse files
committed
Merge branch 'release/1.2.3' into v1
2 parents e716002 + fb3d8a7 commit 3d3d51e

File tree

11 files changed

+160
-84
lines changed

11 files changed

+160
-84
lines changed

CHANGELOG.md

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

3+
## 1.2.3 - 2019.03.20
4+
### Changed
5+
* Allow setting threads in config
6+
* Added a "generate" (bool) parameter to `getVideoUrl()`, just like `getVideoThumbnailUrl()`, to optionally skip encoding
7+
* Added return value false to `getVideoThumbnailUrl()` when `ffmpeg` is executed which prevents a URL is always returned, also in case of `ffmpeg` fails te run/create the thumbnail
8+
* Added new config parameter "createSubfolder" (boolean) to create the same subfolders that are defined in the upload target paths of the asset.
9+
* Added config option to prevent cache clearing
10+
* Fixed an issue where `getFileInfo()` would throw an error if `null` was returned
11+
* Fixed an error where certain types of video streams would cause the encoder to throw an exception
12+
313
## 1.2.2 - 2018.10.05
414
### Changed
515
* Updated build process
@@ -14,7 +24,7 @@
1424
* Added multiple output paths and URLs for different media types
1525

1626
### Changed
17-
* Moved to a modern webpack build config for the AdminCP
27+
* Moved to a modern webpack build config for the Control Panel
1828
* Added install confetti
1929

2030
## 1.1.3 - 2018.03.02
@@ -33,7 +43,7 @@
3343
## 1.1.0 - 2018.02.02
3444
### Added
3545
* Transcoder now supports the transcoding of remote video & audio files
36-
* Added the ability to generate a thumbnail for videos in the AdminCP Assets index
46+
* Added the ability to generate a thumbnail for videos in the Control Panel Assets index
3747

3848
### Changed
3949
* Cleaned up the exception handling

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Transcode video & audio files to various formats, and provide video thumbnails
66

7-
![Screenshot](resources/img/plugin-logo.png)
7+
![Screenshot](resources/img/plugin-banner.jpg)
88

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

@@ -21,7 +21,7 @@ To install Transcoder, follow these steps:
2121
1. Install with Composer via `composer require nystudio107/craft-transcoder` from your project directory
2222
2. Install plugin in the Craft Control Panel under Settings > Plugins
2323

24-
You can also install Transcoder via the **Plugin Store** in the Craft AdminCP.
24+
You can also install Transcoder via the **Plugin Store** in the Craft Control Panel.
2525

2626
Transcoder works on Craft 3.x.
2727

@@ -40,7 +40,7 @@ The Transcoder plugin allows you to transcode any video or animated gif (local o
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

43-
Transcoder also allows you to get a thumbnail of a video in any size and at any timecode, and can extract information about audio/video files such. It also automatically adds video thumbnails in the Assets index in the AdminCP.
43+
Transcoder also allows you to get a thumbnail of a video in any size and at any timecode, and can extract information about audio/video files such. It also automatically adds video thumbnails in the Assets index in the Control Panel.
4444

4545
Finally, it lets you download an arbitrary file (such as the transcoded video) via a special download link.
4646

@@ -127,7 +127,7 @@ The file format setting `videoEncoder` is preset to what you'll need to generate
127127

128128
![Screenshot](resources/screenshots/admin-cp-video-thumbnails.png)
129129

130-
Transcoder will also automatically add video thumbnails in the AdminCP Asset index.
130+
Transcoder will also automatically add video thumbnails in the Control Panel Asset index.
131131

132132
### Generating a Transcoded Audio File
133133

@@ -256,7 +256,7 @@ The file format setting `videoEncoder` is preset to what you'll need to generate
256256

257257
![Screenshot](resources/screenshots/admin-cp-video-thumbnails.png)
258258

259-
Transcoder will also automatically add video thumbnails in the AdminCP Asset index.
259+
Transcoder will also automatically add video thumbnails in the Control Panel Asset index.
260260

261261
### Getting Transcoding Progress
262262

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.2",
5+
"version": "1.2.3",
66
"keywords": [
77
"craft",
88
"cms",

resources/img/plugin-banner.jpg

96 KB
Loading

src/Transcoder.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
* @since 1.0.0
4444
*
4545
* @property Transcode $transcode
46+
* @property Settings $settings
47+
* @method Settings getSettings()
4648
*/
4749
class Transcoder extends Plugin
4850
{
@@ -89,6 +91,7 @@ public function init()
8991
public function clearAllCaches()
9092
{
9193
$transcoderPaths = Transcoder::$plugin->getSettings()->transcoderPaths;
94+
9295
foreach ($transcoderPaths as $key => $value) {
9396
$dir = Craft::getAlias($value);
9497
try {
@@ -141,6 +144,7 @@ function (Event $event) {
141144
*/
142145
protected function installEventHandlers()
143146
{
147+
$settings = $this->getSettings();
144148
// Handler: Assets::EVENT_GET_THUMB_PATH
145149
Event::on(
146150
Assets::class,
@@ -157,18 +161,20 @@ function (AssetThumbEvent $event) {
157161
}
158162
}
159163
);
160-
// Add the Transcode path to the list of things the Clear Caches tool can delete.
161-
Event::on(
162-
ClearCaches::class,
163-
ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
164-
function (RegisterCacheOptionsEvent $event) {
165-
$event->options[] = [
166-
'key' => 'transcoder',
167-
'label' => Craft::t('transcoder', 'Transcoder caches'),
168-
'action' => [$this, 'clearAllCaches']
169-
];
170-
}
171-
);
164+
if ($settings->clearCaches) {
165+
// Add the Transcode path to the list of things the Clear Caches tool can delete.
166+
Event::on(
167+
ClearCaches::class,
168+
ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
169+
function (RegisterCacheOptionsEvent $event) {
170+
$event->options[] = [
171+
'key' => 'transcoder',
172+
'label' => Craft::t('transcoder', 'Transcoder caches'),
173+
'action' => [$this, 'clearAllCaches'],
174+
];
175+
}
176+
);
177+
}
172178
// Handler: Plugins::EVENT_AFTER_INSTALL_PLUGIN
173179
Event::on(
174180
Plugins::class,
@@ -203,7 +209,7 @@ function (RegisterUrlRulesEvent $event) {
203209
'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
204210
__METHOD__
205211
);
206-
// Register our AdminCP routes
212+
// Register our Control Panel routes
207213
$event->rules = array_merge(
208214
$event->rules,
209215
$this->customFrontendRoutes()

src/assetbundles/transcoder/dist/css/styles.ff7dcd9158e0d5435c51.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assetbundles/transcoder/src/css/app.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* https://github.com/tailwindcss/tailwindcss/blob/master/css/preflight.css
1414
*/
1515
/**
16-
* We don't want these in the AdminCP
16+
* We don't want these in the Control Panel
1717
* @import "tailwindcss/preflight";
1818
*/
1919

src/config.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
// Use a md5 hash for the filenames instead of parameterized naming
5858
'useHashedNames' => false,
5959

60+
// if a upload location has a subfolder defined, add this to the transcoder paths too
61+
'createSubfolders' => true,
62+
63+
// Add the Clear Caches utility to the CP?
64+
'clearCaches' => false,
65+
6066
// Preset video encoders
6167
'videoEncoders' => [
6268
'h264' => [
@@ -66,6 +72,7 @@
6672
'videoCodecOptions' => '-vprofile high -preset slow -crf 22',
6773
'audioCodec' => 'libfdk_aac',
6874
'audioCodecOptions' => '-async 1000',
75+
'threads' => '0',
6976
],
7077
'webm' => [
7178
'fileSuffix' => '.webm',
@@ -74,12 +81,14 @@
7481
'videoCodecOptions' => '-quality good -cpu-used 0',
7582
'audioCodec' => 'libvorbis',
7683
'audioCodecOptions' => '-async 1000',
84+
'threads' => '0',
7785
],
7886
'gif' => [
7987
'fileSuffix' => '.mp4',
8088
'fileFormat' => 'mp4',
8189
'videoCodec' => 'libx264',
8290
'videoCodecOptions' => '-pix_fmt yuv420p -movflags +faststart -filter:v crop=\'floor(in_w/2)*2:floor(in_h/2)*2\' ',
91+
'threads' => '0',
8392
],
8493
],
8594

@@ -90,19 +99,22 @@
9099
'fileFormat' => 'mp3',
91100
'audioCodec' => 'libmp3lame',
92101
'audioCodecOptions' => '',
102+
'threads' => '0',
93103
],
94104
'aac' => [
95105
'fileSuffix' => '.m4a',
96106
'fileFormat' => 'aac',
97107
'audioCodec' => 'libfdk_aac',
98108
'audioCodecOptions' => '',
109+
'threads' => '0',
99110

100111
],
101112
'ogg' => [
102113
'fileSuffix' => '.ogg',
103114
'fileFormat' => 'ogg',
104115
'audioCodec' => 'libvorbis',
105116
'audioCodecOptions' => '',
117+
'threads' => '0',
106118
],
107119
],
108120

0 commit comments

Comments
 (0)