Skip to content

Commit 08fdc1e

Browse files
authored
Merge pull request #1 from nystudio107/v1
merge with new transcoder version
2 parents 46180cb + e716002 commit 08fdc1e

File tree

64 files changed

+9112
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+9112
-429
lines changed

CHANGELOG.md

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

3+
## 1.2.2 - 2018.10.05
4+
### Changed
5+
* Updated build process
6+
7+
## 1.2.1 - 2018.08.23
8+
### Changed
9+
* Fixed namespacing issues
10+
11+
## 1.2.0 - 2018.08.22
12+
### Added
13+
* Added the ability to encode to animated `.gif` files
14+
* Added multiple output paths and URLs for different media types
15+
16+
### Changed
17+
* Moved to a modern webpack build config for the AdminCP
18+
* Added install confetti
19+
320
## 1.1.3 - 2018.03.02
421
### Changed
522
* Fixed deprecation errors from Craft CMS 3 RC13

README.md

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ 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 cost $59.00 once Craft 3 GA is released._
11+
**Note**: _The license fee for this plugin is $59.00 via the Craft Plugin Store._
1212

1313
## Requirements
1414

15-
This plugin requires Craft CMS 3.0.0-RC1 or later.
15+
This plugin requires Craft CMS 3.0.0 or later.
1616

1717
## Installation
1818

@@ -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 take any video (local or remote), and transcode it into 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:

composer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
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.1.3",
5+
"version": "1.2.2",
66
"keywords": [
77
"craft",
88
"cms",
99
"craftcms",
1010
"craft-plugin",
11-
"transcoder"
11+
"transcoder",
12+
"transcode",
13+
"video",
14+
"audio",
15+
"gif",
16+
"convert",
17+
"format"
1218
],
1319
"support": {
1420
"docs": "https://github.com/nystudio107/craft-transcoder/blob/v1/README.md",
@@ -22,7 +28,7 @@
2228
}
2329
],
2430
"require": {
25-
"craftcms/cms": "^3.0.0-RC9",
31+
"craftcms/cms": "^3.0.0",
2632
"mikehaertl/php-shellcommand": "~1.2"
2733
},
2834
"autoload": {

package.json

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"name": "transcoder",
3+
"version": "1.0.0",
4+
"description": "Transcode video & audio files to various formats, and provide video thumbnails",
5+
"copyright": "nystudio107",
6+
"main": "index.js",
7+
"scripts": {
8+
"dev": "webpack-dev-server --config webpack.dev.js --progress --hide-modules",
9+
"build": "webpack --config webpack.prod.js"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/nystudio107/craft-transcoder.git"
14+
},
15+
"author": "andrew@nystudio107.com",
16+
"license": "proprietary",
17+
"bugs": {
18+
"url": "https://github.com/nystudio107/craft-transcoder/issues"
19+
},
20+
"homepage": "https://github.com/nystudio107/craft-transcoder",
21+
"paths": {
22+
"src": {
23+
"base": "./src/assetbundles/transcoder/src/",
24+
"js": "./src/assetbundles/transcoder/src/js/",
25+
"css": "./src/assetbundles/transcoder/src/css/"
26+
},
27+
"dist": {
28+
"base": "./src/assetbundles/transcoder/dist/",
29+
"public": "/cpresources/transcoder/",
30+
"devPublic": "http://192.168.10.10:8080",
31+
"clean": [
32+
"./js",
33+
"./css"
34+
]
35+
},
36+
"copyFiles": [
37+
],
38+
"manifest": {
39+
"basePath": ""
40+
},
41+
"templates": "./src/templates/"
42+
},
43+
"entries": {
44+
"transcoder": "Transcoder.js",
45+
"welcome": "Welcome.js"
46+
},
47+
"babelConfig": {
48+
"legacyBrowsers": [
49+
"> 1%",
50+
"last 2 versions",
51+
"Firefox ESR"
52+
],
53+
"modernBrowsers": [
54+
"last 2 Chrome versions",
55+
"not Chrome < 60",
56+
"last 2 Safari versions",
57+
"not Safari < 10.1",
58+
"last 2 iOS versions",
59+
"not iOS < 10.3",
60+
"last 2 Firefox versions",
61+
"not Firefox < 54",
62+
"last 2 Edge versions",
63+
"not Edge < 15"
64+
]
65+
},
66+
"purgeCss": {
67+
"paths": [
68+
"./src/templates/**/*.{twig,html}"
69+
],
70+
"whitelist": [
71+
"../css/components.pcss"
72+
],
73+
"whitelistPatterns": [],
74+
"extensions": [
75+
"html",
76+
"js",
77+
"twig",
78+
"vue"
79+
]
80+
},
81+
"urls": {},
82+
"vars": {
83+
"cssName": "styles",
84+
"jsName": "transcoder"
85+
},
86+
"devDependencies": {
87+
"@babel/core": "^7.1.0",
88+
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
89+
"@babel/plugin-transform-runtime": "^7.1.0",
90+
"@babel/preset-env": "^7.1.0",
91+
"@babel/register": "^7.0.0",
92+
"@babel/runtime": "^7.0.0",
93+
"autoprefixer": "^9.1.5",
94+
"babel-loader": "^8.0.2",
95+
"clean-webpack-plugin": "^0.1.19",
96+
"copy-webpack-plugin": "^4.5.2",
97+
"css-loader": "^1.0.0",
98+
"cssnano": "^4.1.0",
99+
"file-loader": "^2.0.0",
100+
"git-rev-sync": "^1.12.0",
101+
"glob-all": "^3.1.0",
102+
"ignore-loader": "^0.1.2",
103+
"mini-css-extract-plugin": "^0.4.3",
104+
"moment": "^2.22.2",
105+
"optimize-css-assets-webpack-plugin": "^5.0.1",
106+
"postcss": "^7.0.2",
107+
"postcss-extend": "^1.0.5",
108+
"postcss-hexrgba": "^1.0.1",
109+
"postcss-import": "^12.0.0",
110+
"postcss-loader": "^3.0.0",
111+
"postcss-nested": "^4.1.0",
112+
"postcss-nested-ancestors": "^2.0.0",
113+
"postcss-simple-vars": "^5.0.1",
114+
"purgecss-webpack-plugin": "^1.3.0",
115+
"purgecss-whitelister": "^2.2.0",
116+
"resolve-url-loader": "^3.0.0",
117+
"style-loader": "^0.23.0",
118+
"terser-webpack-plugin": "^1.1.0",
119+
"vue-loader": "^15.4.2",
120+
"vue-style-loader": "^4.1.2",
121+
"vue-template-compiler": "^2.5.17",
122+
"webpack": "^4.19.1",
123+
"webpack-bundle-analyzer": "^3.0.2",
124+
"webpack-cli": "^3.1.1",
125+
"webpack-dev-server": "^3.1.9",
126+
"webpack-manifest-plugin": "^2.0.4",
127+
"webpack-merge": "^4.1.4",
128+
"webpack-notifier": "^1.6.0"
129+
},
130+
"dependencies": {
131+
"@babel/polyfill": "^7.0.0",
132+
"tailwindcss": "^0.6.6",
133+
"vue": "^2.5.17",
134+
"vue-confetti": "^0.4.1"
135+
}
136+
}

postcss.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
plugins: [
3+
require('postcss-import'),
4+
require('postcss-extend'),
5+
require('postcss-simple-vars'),
6+
require('postcss-nested-ancestors'),
7+
require('postcss-nested'),
8+
require('postcss-hexrgba'),
9+
require('autoprefixer'),
10+
require('tailwindcss')('./tailwind.config.js')
11+
]
12+
}
-150 KB
Loading
-1.13 KB
Loading
-945 Bytes
Loading
-1.21 KB
Loading
54.1 KB
Loading

0 commit comments

Comments
 (0)