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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9236d95b23d74bf963df893cb8b90281fd403f9c
4
- data.tar.gz: f1a176a698a89323d4ac0bb258cf858b6c698c32
3
+ metadata.gz: e89e7ba3df570de007f02cec74f4062228d71ac9
4
+ data.tar.gz: 9fe646b3d44d966870fe0f6eef44ecf8aa300087
5
5
  SHA512:
6
- metadata.gz: d648c21a5ab319268f2a364e504d530e0947da7ccfd59ae04a30bafe88da669af5e84b93fe9f2409eda36ba375d58d837dcc025c563715ce6a760fbb17d5bdaa
7
- data.tar.gz: acf0dfb58e9ff1b0ab22d820f6e9606d38f4c8ef93ab76985bc0ea7c0be1a9cc036686a7b0a58f4bc999f70b629128bbbd1e955fb89602f62929861ec7cbbc10
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 framework for digital asset management. One Hydra based application - [https://github.com/avalonmediasystem](Avalon Media System) - has relatively robust support for multimedia streaming. However, Avalon is not nearly as flexible or feature rich as [](Sufia) (another Hydra "head") as an asset management system. Avalon also relies on a clunky party transcoding service (Matterhorn) and external streaming server (Red5 or Wowza), creating an unweildly application stack. We wanted the streaming power and flexiblity promised by Avalon, in a mature and flexible 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.
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
- Streaming media presents a challenge in balancing speed with security. Media streaming requires many requests to a server, each for a small peice of the media file being played. Each of these requests must be individually authenticated to prevent access by unauthorized users. Our Rails app requires full control over which users are authorized to view which files. If we load our whole Rails app for each media request we put a big load on our 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 linking directly to those segments and bypassing our authorization system entirely.
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
- Instead, my Rails engine uses signed tokens 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.
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
- This software is not a DRM solution. We do not claim or intend to offer protection against authorized clients storing streamed media locally and then using it in undesired ways. We only seek to limit streaming from our servers to unauthorized clients.
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
 
@@ -100,7 +100,7 @@ module HydraHls
100
100
  end
101
101
 
102
102
  def hls_config
103
- @hls_config ||= YAML.load_file(Rails.root.join('config','transcoding.yml'))
103
+ @hls_config ||= YAML.load_file(Rails.root.join('config','hls.yml'))
104
104
  end
105
105
 
106
106
  def segment_playlist_path format
File without changes
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Installs hydra_hls into your rails application.
3
+ * adds the routes to playlist files
4
+ * adds hls derivative file creation
5
+ * installs new viewer for adaptive streaming display
6
+
7
+ Example:
8
+ rails generate hydra_hls:install
@@ -1,6 +1,6 @@
1
1
  require 'rails/generators'
2
- class Qa::InstallGenerator < Rails::Generators::Base
3
- source_root File.expand_path('./templates', __FILE__)
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/transcoding.yml.example", "config/transcoding.yml"
19
+ copy_file "config/hls.yml.example", "config/hls.yml"
20
20
  end
21
21
 
22
22
  def copy_file_sets_controller
@@ -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','transcoding.yml'))["audio"]
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','transcoding.yml'))["video"]
25
+ config = YAML.load_file(Rails.root.join('config','hls.yml'))["video"]
26
26
  config["default"].merge(config[format])
27
27
  end
28
28
 
@@ -1,3 +1,3 @@
1
1
  module HydraHls
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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
- - config/transcoding.yml
50
- - lib/generators/hydra_hls/install_generator.rb
51
- - lib/generators/hydra_hls/templates/config/transcoding.yml
52
- - lib/generators/hydra_hls/templates/config/transcoding.yml.example
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