hydra_hls 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/app/models/concerns/hydra_hls/file_set_behavior.rb +1 -1
- data/config/{transcoding.yml → hls.yml} +0 -0
- data/lib/generators/hydra_hls/install/USAGE +8 -0
- data/lib/generators/hydra_hls/{install_generator.rb → install/install_generator.rb} +3 -3
- data/lib/generators/hydra_hls/{templates/config/transcoding.yml.example → install/templates/config/hls.yml.example} +0 -0
- data/lib/generators/hydra_hls/{templates → install/templates}/controllers/file_sets_controller.rb +0 -0
- data/lib/hydra_hls/derivatives/processors/audio.rb +1 -1
- data/lib/hydra_hls/derivatives/processors/video.rb +1 -1
- data/lib/hydra_hls/version.rb +1 -1
- metadata +6 -6
- data/lib/generators/hydra_hls/templates/config/transcoding.yml +0 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e89e7ba3df570de007f02cec74f4062228d71ac9
|
|
4
|
+
data.tar.gz: 9fe646b3d44d966870fe0f6eef44ecf8aa300087
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 310c0568b99d3bb6da7ce59444dfb09368c8581e4903ab5441e8a61af9b597ccf585b02b76cd14dd40d42d12abbe93885269b9785da3a3edc760af9285131770
|
|
7
|
+
data.tar.gz: 31c46697adddffb92b19f13bca01122765064fecd299e8bfa3ce14cd062199868dd6e0ff9f56828bd0023b0a12f55f4a98a93a47d6fab4787e01a7cd2b94177f
|
data/README.md
CHANGED
|
@@ -5,15 +5,15 @@ This gem allows a hydra application to create hls derivative media files automat
|
|
|
5
5
|
|
|
6
6
|
## Motivation
|
|
7
7
|
|
|
8
|
-
Hydra is a promising
|
|
8
|
+
Hydra is a promising digital asset management solution with a growign feature set, and we wanted to use as a streaming media service for audiovisual collections. One Hydra based application - [Avalon Media System](https://github.com/avalonmediasystem) - is designed specifically to support multimedia streaming. However, Avalon is not nearly as flexible or well developed as [Sufia](https://github.com/projecthydra/sufia) (another Hydra "head") as an asset management system, and its developer community is relatively small. Avalon also relies on a clunky party transcoding service (Matterhorn) and external streaming server (Red5 or Wowza), creating an unweildly and bug-pronesoftware stack. We wanted the streaming power and flexiblity promised by Avalon, in a more flexible and feature-rich asset management system like Sufia. This gem aims to integrate all of the benefits of adaptive bitrate streaming into Sufia's existing simple, efficient system for creating multimedia derivative files.
|
|
9
9
|
|
|
10
|
-
## Security
|
|
10
|
+
## Security & tokens
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
This software is not a DRM solution. We do not claim or intend to offer protection against authorized clients storing streamed media and then using it in undesired ways. We only seek to limit streaming from our servers to authorized clients.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Streaming media presents a challenge in balancing speed with security. Media streaming requires many requests to a server, each for a small segment of the media file being played. Each of these requests must be individually authenticated to prevent access by unauthorized users. We want to give our Rails app full control over which users are authorized to view which files - but if we load our whole Rails app for each media request, we put a big load on the server and ruin our streaming media performance. On the other hand, if we don't authenticate requests for media segments (Avalon doesn't) we risk people creating their own playlist files linking directly to those segments and bypassing our authorization system entirely.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Instead, my Rails engine uses signed tokens (using a SHA-256 hash and secret key) which grant direct access to a specific file's media segments for a specified period of time. When an authorized client requests a media segment, the token is authenticated by a lightweight external script which does not need to load the entire Rails app. If a malicious client tries to link to this segment file, the link will break quickly when the token expires.
|
|
17
17
|
|
|
18
18
|
## Requirements
|
|
19
19
|
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'rails/generators'
|
|
2
|
-
class
|
|
3
|
-
source_root File.expand_path('
|
|
2
|
+
class HydraHls::InstallGenerator < Rails::Generators::Base
|
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
4
4
|
|
|
5
5
|
def inject_routes
|
|
6
6
|
insert_into_file "config/routes.rb", :after => ".draw do" do
|
|
@@ -16,7 +16,7 @@ class Qa::InstallGenerator < Rails::Generators::Base
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def copy_transcoding_config
|
|
19
|
-
copy_file "config/
|
|
19
|
+
copy_file "config/hls.yml.example", "config/hls.yml"
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def copy_file_sets_controller
|
|
File without changes
|
data/lib/generators/hydra_hls/{templates → install/templates}/controllers/file_sets_controller.rb
RENAMED
|
File without changes
|
|
@@ -22,7 +22,7 @@ module HydraHls::Derivatives::Processors
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
24
|
def get_hls_options(format)
|
|
25
|
-
config = YAML.load_file(Rails.root.join('config','
|
|
25
|
+
config = YAML.load_file(Rails.root.join('config','hls.yml'))["audio"]
|
|
26
26
|
config["default"].merge(config[format])
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -22,7 +22,7 @@ module HydraHls::Derivatives::Processors
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
24
|
def get_hls_options(format)
|
|
25
|
-
config = YAML.load_file(Rails.root.join('config','
|
|
25
|
+
config = YAML.load_file(Rails.root.join('config','hls.yml'))["video"]
|
|
26
26
|
config["default"].merge(config[format])
|
|
27
27
|
end
|
|
28
28
|
|
data/lib/hydra_hls/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hydra_hls
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ned Henry, UCSC Library Digital Initiatives
|
|
@@ -45,12 +45,12 @@ files:
|
|
|
45
45
|
- app/views/curation_concerns/file_sets/embed.html.erb
|
|
46
46
|
- app/views/curation_concerns/file_sets/media_display/_audio_hls.html.erb
|
|
47
47
|
- app/views/curation_concerns/file_sets/media_display/_video_hls.html.erb
|
|
48
|
+
- config/hls.yml
|
|
48
49
|
- config/routes.rb
|
|
49
|
-
-
|
|
50
|
-
- lib/generators/hydra_hls/install_generator.rb
|
|
51
|
-
- lib/generators/hydra_hls/templates/config/
|
|
52
|
-
- lib/generators/hydra_hls/templates/
|
|
53
|
-
- lib/generators/hydra_hls/templates/controllers/file_sets_controller.rb
|
|
50
|
+
- lib/generators/hydra_hls/install/USAGE
|
|
51
|
+
- lib/generators/hydra_hls/install/install_generator.rb
|
|
52
|
+
- lib/generators/hydra_hls/install/templates/config/hls.yml.example
|
|
53
|
+
- lib/generators/hydra_hls/install/templates/controllers/file_sets_controller.rb
|
|
54
54
|
- lib/hydra_hls.rb
|
|
55
55
|
- lib/hydra_hls/derivatives.rb
|
|
56
56
|
- lib/hydra_hls/derivatives/audio_derivatives.rb
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
token_secret: <%= ENV["hls_token_secret"] %>
|
|
3
|
-
video:
|
|
4
|
-
hls_high:
|
|
5
|
-
bitrate: 6500000
|
|
6
|
-
maxrate: 6800000
|
|
7
|
-
vf: "scale=1280:-2"
|
|
8
|
-
resolution: "1280x720"
|
|
9
|
-
hls_med:
|
|
10
|
-
bitrate: 3500000
|
|
11
|
-
maxrate: 3600000
|
|
12
|
-
vf: "scale=960:-2"
|
|
13
|
-
resolution: "960x540"
|
|
14
|
-
hls_low:
|
|
15
|
-
r: 15
|
|
16
|
-
profile_v: baseline
|
|
17
|
-
level: 3.0
|
|
18
|
-
bitrate: 400000
|
|
19
|
-
maxrate: 420000
|
|
20
|
-
g: 45
|
|
21
|
-
segment_list_type: m3u8
|
|
22
|
-
vf: "scale=480:-2"
|
|
23
|
-
codec_code: "mp4a.40.2,avc1.42001e"
|
|
24
|
-
resolution: "480x360"
|
|
25
|
-
default:
|
|
26
|
-
r: 29.97
|
|
27
|
-
pix_fmt: yuv420p
|
|
28
|
-
vcodec: libx264
|
|
29
|
-
acodec: aac
|
|
30
|
-
profile_v: main
|
|
31
|
-
level: 3.1
|
|
32
|
-
codec_code: "mp4a.40.2,avc1.4d001f"
|
|
33
|
-
segment_time: 9
|
|
34
|
-
g: 90
|
|
35
|
-
vf: "scale=960:-2"
|
|
36
|
-
audio:
|
|
37
|
-
hls_hd:
|
|
38
|
-
bitrate: 128000
|
|
39
|
-
maxrate: 140000
|
|
40
|
-
hls:
|
|
41
|
-
bitrate: 64000
|
|
42
|
-
maxrate: 70000
|
|
43
|
-
default:
|
|
44
|
-
acodec: aac
|
|
45
|
-
flags: "-f segment -global_header"
|
|
46
|
-
segment_time: 9
|
|
47
|
-
segment_format: mpeg_ts
|
|
48
|
-
segment_list_type: m3u8
|
|
49
|
-
codec_code: "mp4a.40.2"
|
|
50
|
-
resolution: 300x50
|