active_encode 0.8.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +26 -17
- data/.rubocop.yml +7 -3
- data/.rubocop_todo.yml +8 -1
- data/CONTRIBUTING.md +42 -12
- data/Gemfile +11 -11
- data/README.md +64 -10
- data/active_encode.gemspec +2 -4
- data/app/controllers/active_encode/encode_record_controller.rb +1 -1
- data/app/jobs/active_encode/polling_job.rb +1 -1
- data/app/models/active_encode/encode_record.rb +1 -1
- data/guides/media_convert_adapter.md +208 -0
- data/lib/active_encode/base.rb +1 -1
- data/lib/active_encode/core.rb +14 -14
- data/lib/active_encode/engine_adapter.rb +13 -13
- data/lib/active_encode/engine_adapters/elastic_transcoder_adapter.rb +158 -158
- data/lib/active_encode/engine_adapters/ffmpeg_adapter.rb +14 -3
- data/lib/active_encode/engine_adapters/matterhorn_adapter.rb +204 -202
- data/lib/active_encode/engine_adapters/media_convert_adapter.rb +435 -203
- data/lib/active_encode/engine_adapters/media_convert_output.rb +67 -5
- data/lib/active_encode/engine_adapters/pass_through_adapter.rb +3 -3
- data/lib/active_encode/engine_adapters/zencoder_adapter.rb +114 -114
- data/lib/active_encode/errors.rb +1 -1
- data/lib/active_encode/persistence.rb +19 -19
- data/lib/active_encode/version.rb +1 -1
- data/lib/file_locator.rb +6 -6
- data/spec/fixtures/ffmpeg/cancelled-id/exit_status.code +1 -0
- data/spec/fixtures/ffmpeg/completed-id/exit_status.code +1 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/error.log +3 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/exit_status.code +1 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/input_metadata +102 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/output_metadata-high +90 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/output_metadata-low +90 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/pid +1 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/progress +11 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/failed-id/exit_status.code +1 -0
- data/spec/fixtures/media_convert/job_completed_empty_detail.json +1 -0
- data/spec/integration/ffmpeg_adapter_spec.rb +50 -1
- data/spec/integration/matterhorn_adapter_spec.rb +1 -2
- data/spec/integration/media_convert_adapter_spec.rb +144 -0
- data/spec/integration/pass_through_adapter_spec.rb +2 -2
- data/spec/integration/zencoder_adapter_spec.rb +3 -3
- data/spec/units/core_spec.rb +1 -1
- data/spec/units/file_locator_spec.rb +3 -3
- data/spec/units/status_spec.rb +1 -1
- metadata +52 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc3915da436ad8220ab0a23f27280ad490dd31b1250f56957ca2667ecd6666d
|
4
|
+
data.tar.gz: 6a43e177fbe445be244a80ee44f503324d0e34f98fc4ac90e9b20f5110c120c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7936993f21839c01bab5f3dd6cb7614bb837244c2ab9de2fa5953154d9f0a5c3460a485a2da1748f74c545b76d555c35c18decf697791002783d3607efaaed57
|
7
|
+
data.tar.gz: '069ba0aaec4e5e0a31661018a560cfb73d9d39092076c0f3c9fdcc7ee7afea9ad1a23b5114fca4bd1aadd16f85b7c1d0f59a8206ef89b20efc1ccf7a2bd6a93c'
|
data/.circleci/config.yml
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
version: 2.1
|
2
2
|
orbs:
|
3
|
-
samvera: samvera/circleci-orb@
|
3
|
+
samvera: samvera/circleci-orb@1
|
4
4
|
jobs:
|
5
5
|
bundle_and_test:
|
6
6
|
parameters:
|
7
7
|
ruby_version:
|
8
8
|
type: string
|
9
|
-
default: 2.6.3
|
10
9
|
rails_version:
|
11
10
|
type: string
|
12
|
-
default: 5.2.3
|
13
11
|
bundler_version:
|
14
12
|
type: string
|
15
13
|
default: 2.0.2
|
@@ -27,11 +25,12 @@ jobs:
|
|
27
25
|
steps:
|
28
26
|
- run:
|
29
27
|
command: |
|
28
|
+
sudo apt-get update
|
30
29
|
sudo apt-get install libmms0
|
31
|
-
sudo wget -P /tmp/ https://mediaarea.net/download/binary/libzen0/0.4.
|
32
|
-
sudo wget -P /tmp/ https://mediaarea.net/download/binary/libmediainfo0/
|
33
|
-
sudo wget -P /tmp/ https://mediaarea.net/download/binary/mediainfo/
|
34
|
-
sudo dpkg -i /tmp/libzen0v5_0.4.
|
30
|
+
sudo wget -P /tmp/ https://mediaarea.net/download/binary/libzen0/0.4.39/libzen0v5_0.4.39-1_amd64.Debian_11.deb
|
31
|
+
sudo wget -P /tmp/ https://mediaarea.net/download/binary/libmediainfo0/22.03/libmediainfo0v5_22.03-1_amd64.Debian_11.deb
|
32
|
+
sudo wget -P /tmp/ https://mediaarea.net/download/binary/mediainfo/22.03/mediainfo_22.03-1_amd64.Debian_11.deb
|
33
|
+
sudo dpkg -i /tmp/libzen0v5_0.4.39-1_amd64.Debian_11.deb /tmp/libmediainfo0v5_22.03-1_amd64.Debian_11.deb /tmp/mediainfo_22.03-1_amd64.Debian_11.deb
|
35
34
|
|
36
35
|
- restore_cache:
|
37
36
|
keys:
|
@@ -65,16 +64,26 @@ workflows:
|
|
65
64
|
ci:
|
66
65
|
jobs:
|
67
66
|
- bundle_and_test:
|
68
|
-
name: "
|
69
|
-
ruby_version: "
|
67
|
+
name: "ruby3-0_rails7-0"
|
68
|
+
ruby_version: "3.0.3"
|
69
|
+
rails_version: "7.0.1"
|
70
|
+
- bundle_and_test:
|
71
|
+
name: "ruby3-0_rails6-1"
|
72
|
+
ruby_version: "3.0.3"
|
73
|
+
rails_version: "6.1.4.4"
|
70
74
|
- bundle_and_test:
|
71
|
-
name: "
|
72
|
-
ruby_version: "
|
75
|
+
name: "ruby3-0_rails6-0"
|
76
|
+
ruby_version: "3.0.3"
|
77
|
+
rails_version: "6.0.4.4"
|
73
78
|
- bundle_and_test:
|
74
|
-
name: "ruby2-
|
75
|
-
ruby_version: "2.
|
76
|
-
rails_version: "
|
79
|
+
name: "ruby2-7_rails6-0"
|
80
|
+
ruby_version: "2.7.5"
|
81
|
+
rails_version: "6.0.4.4"
|
77
82
|
- bundle_and_test:
|
78
|
-
name: "ruby2-
|
79
|
-
ruby_version: "2.
|
80
|
-
rails_version: "5.
|
83
|
+
name: "ruby2-7_rails5-2"
|
84
|
+
ruby_version: "2.7.5"
|
85
|
+
rails_version: "5.2.6"
|
86
|
+
- bundle_and_test:
|
87
|
+
name: "ruby2-6_rails5-2"
|
88
|
+
ruby_version: "2.6.9"
|
89
|
+
rails_version: "5.2.6"
|
data/.rubocop.yml
CHANGED
@@ -5,10 +5,14 @@ inherit_from: .rubocop_todo.yml
|
|
5
5
|
|
6
6
|
|
7
7
|
AllCops:
|
8
|
-
TargetRubyVersion: 2.
|
8
|
+
TargetRubyVersion: 2.6
|
9
9
|
DisplayCopNames: true
|
10
10
|
Exclude:
|
11
11
|
- 'active_encode.gemspec'
|
12
12
|
- 'vendor/**/*'
|
13
|
-
|
14
|
-
|
13
|
+
|
14
|
+
Rails/RakeEnvironment:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/IfUnlessModifier:
|
18
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -18,12 +18,18 @@ Metrics/ClassLength:
|
|
18
18
|
Exclude:
|
19
19
|
- 'lib/active_encode/engine_adapters/*'
|
20
20
|
|
21
|
+
Metrics/ModuleLength:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/active_encode/engine_adapters/*'
|
24
|
+
|
21
25
|
Metrics/CyclomaticComplexity:
|
22
26
|
Exclude:
|
27
|
+
- 'lib/active_encode/engine_adapters/elastic_transcoder_adapter.rb'
|
23
28
|
- 'lib/active_encode/engine_adapters/ffmpeg_adapter.rb'
|
24
29
|
- 'lib/active_encode/engine_adapters/zencoder_adapter.rb'
|
30
|
+
- 'lib/active_encode/engine_adapters/media_convert_adapter.rb'
|
25
31
|
|
26
|
-
|
32
|
+
Layout/LineLength:
|
27
33
|
Exclude:
|
28
34
|
- 'lib/active_encode/engine_adapters/matterhorn_adapter.rb'
|
29
35
|
- 'spec/**/*'
|
@@ -36,6 +42,7 @@ Metrics/MethodLength:
|
|
36
42
|
Metrics/PerceivedComplexity:
|
37
43
|
Exclude:
|
38
44
|
- 'lib/active_encode/engine_adapters/ffmpeg_adapter.rb'
|
45
|
+
- 'lib/active_encode/engine_adapters/media_convert_adapter.rb'
|
39
46
|
- 'lib/file_locator.rb'
|
40
47
|
|
41
48
|
RSpec/AnyInstance:
|
data/CONTRIBUTING.md
CHANGED
@@ -22,6 +22,28 @@ https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Proper
|
|
22
22
|
|
23
23
|
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
24
24
|
|
25
|
+
## Language
|
26
|
+
|
27
|
+
The language we use matters. Today, tomorrow, and for years to come
|
28
|
+
people will read the code we write. They will judge us for our
|
29
|
+
design, logic, and the words we use to describe the system.
|
30
|
+
|
31
|
+
Our words should be accessible. Favor descriptive words that give
|
32
|
+
meaning while avoiding reinforcing systemic inequities. For example,
|
33
|
+
in the Samvera community, we should favor using allowed\_list instead
|
34
|
+
of whitelist, denied\_list instead of blacklist, or source/copy
|
35
|
+
instead of master/slave.
|
36
|
+
|
37
|
+
We're going to get it wrong, but this is a call to keep working to
|
38
|
+
make it right. View our code and the words we choose as a chance to
|
39
|
+
have a conversation. A chance to grow an understanding of the systems
|
40
|
+
we develop as well as the systems in which we live.
|
41
|
+
|
42
|
+
See [“Blacklists” and “whitelists”: a salutary warning concerning the
|
43
|
+
prevalence of racist language in discussions of predatory
|
44
|
+
publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
|
45
|
+
further details.
|
46
|
+
|
25
47
|
## Contribution Tasks
|
26
48
|
|
27
49
|
* Reporting Issues
|
@@ -45,15 +67,22 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
45
67
|
|
46
68
|
* Fork the repository on GitHub
|
47
69
|
* Create a topic branch from where you want to base your work.
|
48
|
-
* This is usually the
|
49
|
-
* To quickly create a topic branch based on
|
50
|
-
* Then checkout the new branch with `git checkout fix/
|
51
|
-
* Please avoid working directly on the `
|
70
|
+
* This is usually the `main` branch.
|
71
|
+
* To quickly create a topic branch based on `main`; `git branch fix/master/my_contribution main`
|
72
|
+
* Then checkout the new branch with `git checkout fix/main/my_contribution`.
|
73
|
+
* Please avoid working directly on the `main` branch.
|
74
|
+
* Please do not create a branch called `master`. (See note below.)
|
52
75
|
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
53
76
|
* Make sure you have added sufficient tests and documentation for your changes.
|
54
77
|
* Test functionality with RSpec; Test features / UI with Capybara.
|
55
78
|
* Run _all_ the tests to assure nothing else was accidentally broken.
|
56
79
|
|
80
|
+
NOTE: This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct)
|
81
|
+
and [language recommendations](#language).
|
82
|
+
Please ***do not*** create a branch called `master` for this repository or as part of
|
83
|
+
your pull request; the branch will either need to be removed or renamed before it can
|
84
|
+
be considered for inclusion in the code base and history of this repository.
|
85
|
+
|
57
86
|
### Documenting Code
|
58
87
|
|
59
88
|
* All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
|
@@ -109,15 +138,15 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
109
138
|
### Submitting Changes
|
110
139
|
|
111
140
|
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
112
|
-
* Make sure your branch is up to date with its parent branch (i.e.
|
113
|
-
* `git checkout
|
141
|
+
* Make sure your branch is up to date with its parent branch (i.e. main)
|
142
|
+
* `git checkout main`
|
114
143
|
* `git pull --rebase`
|
115
144
|
* `git checkout <your-branch>`
|
116
|
-
* `git rebase
|
145
|
+
* `git rebase main`
|
117
146
|
* It is a good idea to run your tests again.
|
118
147
|
* If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
|
119
148
|
* [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
|
120
|
-
* `git rebase --interactive
|
149
|
+
* `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
|
121
150
|
* Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
|
122
151
|
* Push your changes to a topic branch in your fork of the repository.
|
123
152
|
* Submit a pull request from your fork to the project.
|
@@ -127,12 +156,13 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
127
156
|
We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
|
128
157
|
Common checks that may occur in our repositories:
|
129
158
|
|
130
|
-
1.
|
131
|
-
2.
|
159
|
+
1. [CircleCI](https://circleci.com/gh/samvera) - where our automated tests are running
|
160
|
+
2. RuboCop/Bixby - where we check for style violations
|
161
|
+
3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
|
132
162
|
|
133
163
|
If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
|
134
164
|
|
135
|
-
*Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (
|
165
|
+
*Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (CI are usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
|
136
166
|
|
137
167
|
#### Things to Consider When Reviewing
|
138
168
|
|
@@ -149,7 +179,7 @@ This is your chance for a mentoring moment of another developer. Take time to gi
|
|
149
179
|
* Do new or changed methods, modules, and classes have documentation?
|
150
180
|
* Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
|
151
181
|
* Does the description of the new/changed specs match your understanding of what the spec is doing?
|
152
|
-
* Did the
|
182
|
+
* Did the Continuous Integration tests complete successfully?
|
153
183
|
|
154
184
|
If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
|
155
185
|
|
data/Gemfile
CHANGED
@@ -4,7 +4,6 @@ source 'https://rubygems.org'
|
|
4
4
|
# Specify your gem's dependencies in hydra-transcoder.gemspec
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'addressable'
|
8
7
|
gem 'aws-sdk-elastictranscoder'
|
9
8
|
gem 'aws-sdk-s3'
|
10
9
|
gem 'byebug'
|
@@ -13,8 +12,8 @@ gem 'shingoncoder'
|
|
13
12
|
gem 'zencoder'
|
14
13
|
|
15
14
|
# BEGIN ENGINE_CART BLOCK
|
16
|
-
# engine_cart: 2.0
|
17
|
-
# engine_cart stanza:
|
15
|
+
# engine_cart: 2.4.0
|
16
|
+
# engine_cart stanza: 2.5.0
|
18
17
|
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
|
19
18
|
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
|
20
19
|
if File.exist?(file)
|
@@ -34,15 +33,16 @@ else
|
|
34
33
|
else
|
35
34
|
gem 'rails', ENV['RAILS_VERSION']
|
36
35
|
end
|
37
|
-
end
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
case ENV['RAILS_VERSION']
|
38
|
+
when /^6.0/
|
39
|
+
gem 'sass-rails', '>= 6'
|
40
|
+
gem 'webpacker', '~> 4.0'
|
41
|
+
when /^5.[12]/
|
42
|
+
gem 'sass-rails', '~> 5.0'
|
43
|
+
gem 'sprockets', '~> 3.7'
|
44
|
+
gem 'thor', '~> 0.20'
|
45
|
+
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
# END ENGINE_CART BLOCK
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samv
|
|
11
11
|
|
12
12
|
# What is ActiveEncode?
|
13
13
|
|
14
|
-
ActiveEncode serves as the basis for the interface between a Ruby (Rails) application and a provider of encoding services such as [FFmpeg](https://www.ffmpeg.org/), [Amazon Elastic Transcoder](http://aws.amazon.com/elastictranscoder/), and [Zencoder](http://zencoder.com).
|
14
|
+
ActiveEncode serves as the basis for the interface between a Ruby (Rails) application and a provider of encoding services such as [FFmpeg](https://www.ffmpeg.org/), [Amazon Elastic Transcoder](http://aws.amazon.com/elastictranscoder/), [AWS Elemental MediaConvert](https://aws.amazon.com/mediaconvert/), and [Zencoder](http://zencoder.com).
|
15
15
|
|
16
16
|
# Help
|
17
17
|
|
@@ -39,31 +39,54 @@ FFmpeg (tested with version 4+) and mediainfo (version 17.10+) need to be instal
|
|
39
39
|
|
40
40
|
## Usage
|
41
41
|
|
42
|
-
Set the engine adapter (default: test), configure it (if neccessary), then submit encoding jobs
|
42
|
+
Set the engine adapter (default: test), configure it (if neccessary), then submit encoding jobs. The outputs option specifies the output(s) to create in an adapter-specific way, see individual adapter documentation.
|
43
43
|
|
44
44
|
```ruby
|
45
45
|
ActiveEncode::Base.engine_adapter = :ffmpeg
|
46
46
|
file = "file://#{File.absolute_path "spec/fixtures/fireworks.mp4"}"
|
47
47
|
ActiveEncode::Base.create(file, { outputs: [{ label: "low", ffmpeg_opt: "-s 640x480", extension: "mp4"}, { label: "high", ffmpeg_opt: "-s 1280x720", extension: "mp4"}] })
|
48
48
|
```
|
49
|
-
Create returns an encoding job that has been submitted to the adapter for processing. At this point it will have an id, a state, the input, and any additional information the adapter returns.
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
```
|
50
|
+
Create returns an encoding job (which we sometimes call "an encode object") that has been submitted to the adapter for processing. At this point it will have an id, a state, the input url, and possibly additional adapter-specific metadata.
|
51
|
+
|
54
52
|
```ruby
|
55
53
|
encode.id # "1e4a907a-ccff-494f-ad70-b1c5072c2465"
|
56
54
|
encode.state # :running
|
55
|
+
encode.input.url
|
57
56
|
```
|
58
57
|
|
59
|
-
|
58
|
+
At this point the encode is not complete. You can check on status by looking up the encode by id, or by calling #reload on an existing encode object to refresh it:
|
60
59
|
|
61
60
|
```ruby
|
62
61
|
encode = ActiveEncode::Base.find("1e4a907a-ccff-494f-ad70-b1c5072c2465")
|
62
|
+
# or
|
63
63
|
encode.reload
|
64
|
+
|
65
|
+
encode.percent_complete
|
66
|
+
encode.status # running, cancelled, failed, completed
|
67
|
+
encode.errors # array of errors in case of status `failed`
|
68
|
+
```
|
69
|
+
|
70
|
+
Progress of a running encode is shown with current operations (multiple are possible when outputs are generated in parallel) and percent complete.
|
71
|
+
|
72
|
+
Technical metadata about the input file may be added by some adapters, and may be available before completion. This should include a mime type, checksum, duration, and basic technical details of the audio and video content of the file (codec, audio channels, bitrate, frame rate, and dimensions).
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
encode.input.url
|
76
|
+
encode.input.height
|
77
|
+
encode.input.width
|
78
|
+
encode.input.checksum
|
79
|
+
# etc
|
64
80
|
```
|
65
81
|
|
66
|
-
|
82
|
+
Outputs are added once they are created and should include the same technical metadata along with an id, label, and url.
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
output = encode.outputs.first
|
86
|
+
output.url
|
87
|
+
output.id
|
88
|
+
output.width
|
89
|
+
```
|
67
90
|
|
68
91
|
If you want to stop the encoding job call cancel:
|
69
92
|
|
@@ -72,7 +95,7 @@ encode.cancel!
|
|
72
95
|
encode.cancelled? # true
|
73
96
|
```
|
74
97
|
|
75
|
-
An
|
98
|
+
An encode object is meant to be the record of the work of the encoding engine and not the current state of the outputs. Therefore moved or deleted outputs will not be reflected in the encode object.
|
76
99
|
|
77
100
|
### AWS ElasticTranscoder
|
78
101
|
|
@@ -104,6 +127,37 @@ file = 'file:///path/to/file/fireworks.mp4' # or 's3://my-bucket/fireworks.mp4'
|
|
104
127
|
encode = ActiveEncode::Base.create(file, options)
|
105
128
|
```
|
106
129
|
|
130
|
+
### AWS Elemental MediaCovert
|
131
|
+
|
132
|
+
[MediaConvert](https://aws.amazon.com/mediaconvert/) is a newer AWS service than Elastic Transcoder. The MediaConvert adapter works using [output presets]((https://docs.aws.amazon.com/mediaconvert/latest/ug/creating-preset-from-scratch.html)) defined in the MediaConvert service for your account. Some additional dependencies will need to be added to your project, see [Guide](./guides/media_convert_adapter.md).
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
ActiveEncode::Base.engine_adapter = :media_convert
|
136
|
+
ActiveEncode::Base.engine_adapter.role = 'arn:aws:iam::111111111111:role/name-of-role'
|
137
|
+
ActiveEncode::Base.engine_adapter.output_bucket = 'name-of-bucket'
|
138
|
+
|
139
|
+
# will create CloudWatch/EventBridge resources necessary to capture outputs,
|
140
|
+
# only needs to be called once although is safe to call redundantly.
|
141
|
+
ActiveEncode::Base.engine_adapter.setup!
|
142
|
+
|
143
|
+
encode = ActiveEncode::Base.create(
|
144
|
+
"file://path/to/file.mp4",
|
145
|
+
{
|
146
|
+
masterfile_bucket: "name-of-my-masterfile_bucket"
|
147
|
+
output_prefix: "path/to/output/base_name_of_outputs",
|
148
|
+
use_original_url: true,
|
149
|
+
outputs: [
|
150
|
+
{ preset: "my-hls-preset-high", modifier: "_high" },
|
151
|
+
{ preset: "my-hls-preset-medium", modifier: "_medium" },
|
152
|
+
{ preset: "my-hls-preset-low", modifier: "_low" },
|
153
|
+
]
|
154
|
+
}
|
155
|
+
)
|
156
|
+
```
|
157
|
+
|
158
|
+
See more details and guidance in our [longer guide](./guides/media_convert_adapter.md), or in comment docs in [adapter class](./lib/active_encode/engine_adapters/media_convert_adapter.rb).
|
159
|
+
|
160
|
+
|
107
161
|
### Custom jobs
|
108
162
|
|
109
163
|
Subclass ActiveEncode::Base to add custom callbacks or default options. Available callbacks are before, after, and around the create and cancel actions.
|
@@ -136,7 +190,7 @@ module ActiveEncode
|
|
136
190
|
# locally queued job.
|
137
191
|
|
138
192
|
# Return an instance ActiveEncode::Base (or subclass) that represents
|
139
|
-
# the encoding job that was just started.
|
193
|
+
# the encoding job that was just started.
|
140
194
|
end
|
141
195
|
|
142
196
|
def find(id, opts = {})
|
data/active_encode.gemspec
CHANGED
@@ -21,13 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
23
|
spec.add_dependency "rails"
|
24
|
+
spec.add_dependency "addressable", "~> 2.8"
|
24
25
|
|
25
26
|
spec.add_development_dependency "aws-sdk-cloudwatchevents"
|
26
27
|
spec.add_development_dependency "aws-sdk-cloudwatchlogs"
|
27
28
|
spec.add_development_dependency "aws-sdk-elastictranscoder"
|
28
29
|
spec.add_development_dependency "aws-sdk-mediaconvert"
|
29
30
|
spec.add_development_dependency "aws-sdk-s3"
|
30
|
-
spec.add_development_dependency "bixby", '~>
|
31
|
+
spec.add_development_dependency "bixby", '~> 5.0', '>= 5.0.2'
|
31
32
|
spec.add_development_dependency "bundler"
|
32
33
|
spec.add_development_dependency "coveralls"
|
33
34
|
spec.add_development_dependency "database_cleaner"
|
@@ -36,7 +37,4 @@ Gem::Specification.new do |spec|
|
|
36
37
|
spec.add_development_dependency "rspec"
|
37
38
|
spec.add_development_dependency 'rspec_junit_formatter'
|
38
39
|
spec.add_development_dependency "rspec-rails"
|
39
|
-
|
40
|
-
# Pin sprockets to < 4 so it works with ruby 2.5+
|
41
|
-
spec.add_dependency 'sprockets', '< 4'
|
42
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module ActiveEncode
|
3
|
-
class EncodeRecordController <
|
3
|
+
class EncodeRecordController < ApplicationController
|
4
4
|
rescue_from ActiveRecord::RecordNotFound do |e|
|
5
5
|
render json: { message: e.message }, status: :not_found
|
6
6
|
end
|