abrizer 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -2
- data/Vagrantfile +2 -0
- data/abrizer.gemspec +2 -1
- data/ansible/development-playbook.yml +1 -0
- data/ansible/roles/apache/tasks/main.yml +23 -0
- data/ansible/roles/basic-setup/tasks/main.yml +1 -0
- data/lib/abrizer.rb +10 -1
- data/lib/abrizer/all.rb +5 -1
- data/lib/abrizer/canvas.rb +216 -0
- data/lib/abrizer/captions.rb +41 -0
- data/lib/abrizer/cli.rb +23 -3
- data/lib/abrizer/ffprobe_informer.rb +5 -1
- data/lib/abrizer/filepath_helpers.rb +65 -0
- data/lib/abrizer/temporary_poster.rb +20 -0
- data/lib/abrizer/version.rb +1 -1
- metadata +27 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc9378a163fb93bef80e0850ac0133674ac9106f
|
4
|
+
data.tar.gz: 633f89376f94e84237122b36a4aba365d34ef3db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a9aff673d64f3ae930cdffc748aed9a844f82414dd1fd12bb93ddbcc0ae9624096c5a869a5a930ad75f90481aa34e12a8f3b12e0662bb68e6751fa6dbba5891
|
7
|
+
data.tar.gz: 3ef0a0a10a9b21f7645fb9f869f6df5b3a34aff48a87f02928077eb29d0259226fa7860d5c69b9acb41bdfab7382d51b01ed9075853587c4830621c380de2881
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Abrizer
|
2
2
|
|
3
|
-
Abrizer takes a source video and creates various derivatives for delivery including adaptive bitrate formats like DASH and HLS.
|
3
|
+
Abrizer takes a source video and creates various derivatives for delivery including adaptive bitrate formats like DASH and HLS. An opinionated work in progress.
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
@@ -26,6 +26,8 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
$ gem install abrizer
|
28
28
|
|
29
|
+
See [Vagrant](#vagrant) below for one way to install dependencies and run the scripts.
|
30
|
+
|
29
31
|
## Usage
|
30
32
|
|
31
33
|
Abrizer knows how to run various processes which can take a master or mezzanine video and create DASH and HLS streaming formats along with other derivatives like a fallback MP4 and WebM. The gem is opinionated about what formats to create and what settings to use. The intention is to provide a relatively complete but simple solution for delivering video over HTTP.
|
@@ -38,9 +40,10 @@ Some steps must be run after others as they have preconditions in order for subs
|
|
38
40
|
- `mp4`: Process a progressive download MP4 from original
|
39
41
|
- `vp9`: Process a progressive download WebM VP9 from original
|
40
42
|
- `sprites`: Create video sprites and metadata WebVTT file retaining all the images in order for a human to later pick a poster image
|
43
|
+
- `poster`: Copies over a temporary poster image from the output of the sprites
|
41
44
|
- `clean`: Clean out the intermediate and log files including MP4 files used for packaging but not required for delivery
|
42
45
|
|
43
|
-
|
46
|
+
All of the above commands require the path to the original video file and an output directory.
|
44
47
|
|
45
48
|
### Command Line
|
46
49
|
|
@@ -76,12 +79,29 @@ Abrizer::All.new(video_path, output_directory).run
|
|
76
79
|
|
77
80
|
Take a look at `lib/abrizer/all.rb` for how to use the various classes provided. You can also see more examples in `lib/abrizer/cli.rb`. All classes expect to be passed the fully expanded path.
|
78
81
|
|
82
|
+
### Canvas
|
83
|
+
|
84
|
+
Experimental support is provided for creating a IIIF Canvas. Note that this work is done in advance of a draft standard for including video in a IIIF manifest. It can be created after other steps with `abrizer help canvas` for more information.
|
85
|
+
|
79
86
|
## Development
|
80
87
|
|
81
88
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
82
89
|
|
83
90
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
84
91
|
|
92
|
+
## Vagrant
|
93
|
+
|
94
|
+
The easiest way to do development on Abrizer or even try out the scripts is to use a Vagrant machine. If you have Vagrant and Virtualbox installed just run `vagrant up` and all dependencies will be installed.
|
95
|
+
|
96
|
+
This includes a web server that can be used for local testing of streams and videos. After `vagrant up` visit http://localhost:8088/v/ to see the contents of the project's `tmp` directory. Within the virtual machine (`vagrant ssh`) you can process a test video with:
|
97
|
+
|
98
|
+
```shell
|
99
|
+
cd /vagrant
|
100
|
+
bundle exec exe/abrizer all test/videos/FullHDCinemaCountdown720p-8sec.mp4 tmp/countdown http://localhost:8088/v
|
101
|
+
```
|
102
|
+
|
103
|
+
Now visit http://localhost:8088/v/countdown/ to see the files that were created. You can then test any of the videos or streams.
|
104
|
+
|
85
105
|
## Contributing
|
86
106
|
|
87
107
|
Bug reports and pull requests are welcome on GitHub at https://github.com/jronallo/abrizer.
|
data/Vagrantfile
CHANGED
@@ -5,6 +5,8 @@ Vagrant.configure("2") do |config|
|
|
5
5
|
config.vm.box = "boxcutter/centos72"
|
6
6
|
|
7
7
|
config.vm.synced_folder '.', '/vagrant' #, type: 'nfs', mount_options: ['nolock', 'rw', 'vers=3', 'tcp', 'actimeo=2']
|
8
|
+
config.vm.network "forwarded_port", guest: 80, host: 8088,
|
9
|
+
auto_correct: true
|
8
10
|
|
9
11
|
config.vm.provider "virtualbox" do |vb|
|
10
12
|
vb.linked_clone = true
|
data/abrizer.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency "bundler-audit"
|
27
27
|
|
28
28
|
spec.add_dependency "thor"
|
29
|
-
spec.add_dependency 'json'
|
30
29
|
spec.add_dependency 'video_sprites', '0.2.0'
|
30
|
+
spec.add_dependency 'jbuilder'
|
31
|
+
spec.add_dependency 'yajl-ruby'
|
31
32
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
- name: install apache
|
3
|
+
yum:
|
4
|
+
name: httpd
|
5
|
+
state: present
|
6
|
+
- name: enable cors
|
7
|
+
lineinfile:
|
8
|
+
dest: /etc/httpd/conf/httpd.conf
|
9
|
+
line: 'Header set Access-Control-Allow-Origin "*"'
|
10
|
+
# regexp: '<Directory "/var/www/html">'
|
11
|
+
insertafter: '<Directory "/var/www/html">'
|
12
|
+
- name: remove firewall
|
13
|
+
yum:
|
14
|
+
name: firewalld
|
15
|
+
state: removed
|
16
|
+
- name: symlink /var/www/html/v to /vagrant/tmp
|
17
|
+
file:
|
18
|
+
path: /var/www/html/v
|
19
|
+
src: /vagrant/tmp
|
20
|
+
state: link
|
21
|
+
force: yes
|
22
|
+
- name: restart httpd
|
23
|
+
service: name=httpd state=restarted
|
data/lib/abrizer.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'yajl'
|
2
|
+
require 'multi_json'
|
3
|
+
MultiJson.use :yajl
|
4
|
+
MultiJson.dump_options = {pretty: true}
|
5
|
+
require 'jbuilder'
|
2
6
|
require 'video_sprites'
|
3
7
|
require "abrizer/version"
|
4
8
|
require 'abrizer/filepath_helpers'
|
@@ -15,8 +19,13 @@ require 'abrizer/cleaner'
|
|
15
19
|
require 'abrizer/progressive_mp4'
|
16
20
|
require 'abrizer/progressive_vp9'
|
17
21
|
require 'abrizer/sprites'
|
22
|
+
require 'abrizer/captions'
|
23
|
+
require 'abrizer/canvas'
|
24
|
+
require 'abrizer/temporary_poster'
|
18
25
|
require 'abrizer/all'
|
19
26
|
|
27
|
+
|
28
|
+
|
20
29
|
module Abrizer
|
21
30
|
# Your code goes here...
|
22
31
|
end
|
data/lib/abrizer/all.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Abrizer
|
2
2
|
class All
|
3
3
|
|
4
|
-
def initialize(filename, output_dir
|
4
|
+
def initialize(filename, output_dir, base_url)
|
5
5
|
@filename = filename
|
6
6
|
@output_directory = output_dir
|
7
|
+
@base_url = base_url
|
7
8
|
end
|
8
9
|
|
9
10
|
def run
|
@@ -12,7 +13,10 @@ module Abrizer
|
|
12
13
|
Abrizer::ProgressiveVp9.new(@filename, @output_directory).create
|
13
14
|
Abrizer::PackageDashBento.new(@filename, @output_directory).package
|
14
15
|
Abrizer::PackageHlsBento.new(@filename, @output_directory).package
|
16
|
+
Abrizer::Captions.new(@filename, @output_directory).copy
|
15
17
|
Abrizer::Sprites.new(@filename, @output_directory).create
|
18
|
+
Abrizer::TemporaryPoster.new(@output_directory).copy
|
19
|
+
Abrizer::Canvas.new(@filename, @output_directory, @base_url).create
|
16
20
|
Abrizer::Cleaner.new(@filename, @output_directory).clean
|
17
21
|
end
|
18
22
|
|
@@ -0,0 +1,216 @@
|
|
1
|
+
module Abrizer
|
2
|
+
# Creates a IIIF Canvas JSON-LD document.
|
3
|
+
class Canvas
|
4
|
+
|
5
|
+
include FilepathHelpers
|
6
|
+
|
7
|
+
# TODO: allow control of items/versions listed on canvas
|
8
|
+
def initialize(filepath, output_directory, base_url)
|
9
|
+
@filename = filepath
|
10
|
+
@output_directory = output_directory
|
11
|
+
@base_url = base_url
|
12
|
+
finder = AdaptationFinder.new(@filename)
|
13
|
+
@adaptations = finder.adaptations
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
File.open(canvas_filepath, 'w') do |fh|
|
18
|
+
fh.puts create_json
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_json
|
23
|
+
Jbuilder.encode do |json|
|
24
|
+
json.set! '@context', 'http://iiif.io/api/presentation/3/context.json'
|
25
|
+
json.id canvas_id
|
26
|
+
json.type "Canvas"
|
27
|
+
json.width max_width
|
28
|
+
json.height max_height
|
29
|
+
json.duration duration
|
30
|
+
thumbnail_json(json)
|
31
|
+
media_json(json)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def thumbnail_json(json)
|
36
|
+
if File.exist? poster_image_filepath
|
37
|
+
json.thumbnail do
|
38
|
+
json.id poster_id
|
39
|
+
json.type 'Image'
|
40
|
+
json.format 'image/jpeg'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def media_json(json)
|
46
|
+
json.media do
|
47
|
+
json.child! do
|
48
|
+
json.type "Annotation"
|
49
|
+
json.motivation 'painting'
|
50
|
+
json.target canvas_id
|
51
|
+
json.body do
|
52
|
+
json.type "Choice"
|
53
|
+
json.items do
|
54
|
+
mpd_item(json)
|
55
|
+
hlsts_item(json)
|
56
|
+
vp9_item(json)
|
57
|
+
mp4_item(json)
|
58
|
+
end
|
59
|
+
json.seeAlso do
|
60
|
+
# TODO: Allow for adding more than one captions/subtitle file
|
61
|
+
captions_seealso(json)
|
62
|
+
sprites_seealso(json)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def mpd_item(json)
|
70
|
+
if File.exist? mpd_filepath
|
71
|
+
json.child! do
|
72
|
+
json.id mpd_id
|
73
|
+
json.type "Video"
|
74
|
+
json.format "application/dash+xml"
|
75
|
+
json.width max_width
|
76
|
+
json.height max_height
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def hlsts_item(json)
|
82
|
+
if File.exist? hlsts_filepath
|
83
|
+
json.child! do
|
84
|
+
json.id hlsts_id
|
85
|
+
json.type "Video"
|
86
|
+
# TODO: or "vnd.apple.mpegURL"
|
87
|
+
json.format "application/x-mpegURL"
|
88
|
+
json.width max_width
|
89
|
+
json.height max_height
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def vp9_item(json)
|
95
|
+
if File.exist? vp9_filepath
|
96
|
+
json.child! do
|
97
|
+
json.id vp9_id
|
98
|
+
json.type "Video"
|
99
|
+
#TODO: add webm codecs
|
100
|
+
json.format "video/webm"
|
101
|
+
json.width max_width
|
102
|
+
json.height max_height
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def mp4_item(json)
|
108
|
+
if File.exist? mp4_filepath
|
109
|
+
json.child! do
|
110
|
+
json.id mp4_id
|
111
|
+
json.type "Video"
|
112
|
+
#TODO: add mp4 codecs
|
113
|
+
json.format "video/mp4"
|
114
|
+
json.width mp4_width
|
115
|
+
json.height mp4_height
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def captions_seealso(json)
|
121
|
+
# TODO: update captions seeAlso for multiple captions
|
122
|
+
captions_file = File.join output_directory, 'vtt/captions.vtt'
|
123
|
+
if File.exist? captions_file
|
124
|
+
json.child! do
|
125
|
+
json.id vtt_id
|
126
|
+
json.format 'application/webvtt'
|
127
|
+
json.label 'English captions'
|
128
|
+
json.language 'en'
|
129
|
+
json._comments "How make explicit how whether to use these as captions or subtitles?"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def sprites_seealso(json)
|
135
|
+
if File.exist? sprites_filepath
|
136
|
+
json.child! do
|
137
|
+
json.id sprites_id
|
138
|
+
json.format 'application/webvtt'
|
139
|
+
json.label 'image sprite metadata'
|
140
|
+
json._comments "How to include resources like video image sprites like those created by https://github.com/jronallo/video_sprites and used by various players?"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def media_base_url
|
146
|
+
File.join @base_url, output_directory_basename
|
147
|
+
end
|
148
|
+
|
149
|
+
def canvas_id
|
150
|
+
File.join media_base_url, canvas_partial_filepath
|
151
|
+
end
|
152
|
+
|
153
|
+
def poster_id
|
154
|
+
File.join media_base_url, poster_partial_filepath
|
155
|
+
end
|
156
|
+
|
157
|
+
def mpd_id
|
158
|
+
File.join media_base_url, mpd_partial_filepath
|
159
|
+
end
|
160
|
+
|
161
|
+
def hlsts_id
|
162
|
+
File.join media_base_url, hlsts_partial_filepath
|
163
|
+
end
|
164
|
+
|
165
|
+
def mp4_id
|
166
|
+
File.join media_base_url, mp4_partial_filepath
|
167
|
+
end
|
168
|
+
|
169
|
+
def vp9_id
|
170
|
+
File.join media_base_url, vp9_partial_filepath
|
171
|
+
end
|
172
|
+
|
173
|
+
def vtt_id
|
174
|
+
File.join media_base_url, 'vtt/captions.vtt'
|
175
|
+
end
|
176
|
+
|
177
|
+
def sprites_id
|
178
|
+
File.join media_base_url, sprites_partial_filepath
|
179
|
+
end
|
180
|
+
|
181
|
+
def duration
|
182
|
+
informer = Abrizer::FfprobeInformer.new(mp4_filename)
|
183
|
+
informer.duration.to_f
|
184
|
+
end
|
185
|
+
|
186
|
+
def max_width
|
187
|
+
@adaptations.last.width
|
188
|
+
end
|
189
|
+
|
190
|
+
def min_width
|
191
|
+
@adaptations.first.width
|
192
|
+
end
|
193
|
+
|
194
|
+
def max_height
|
195
|
+
@adaptations.last.height
|
196
|
+
end
|
197
|
+
|
198
|
+
def min_height
|
199
|
+
@adaptations.first.height
|
200
|
+
end
|
201
|
+
|
202
|
+
def mp4_width
|
203
|
+
@adaptations[-2].width
|
204
|
+
end
|
205
|
+
|
206
|
+
def mp4_height
|
207
|
+
@adaptations[-2].height
|
208
|
+
end
|
209
|
+
|
210
|
+
# TODO: DRY up with progressive_mp4.rb
|
211
|
+
def mp4_filename
|
212
|
+
File.join output_directory, "progressive.mp4"
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Abrizer
|
2
|
+
# Copies over any WebVTT captions that are beside the original video resource
|
3
|
+
# into the destination folder.
|
4
|
+
# TODO: This may only be needed if fMP4 derivatives aren't created since
|
5
|
+
# captions are copied over.
|
6
|
+
# TODO: Allow for more than one captions/subtitle file to be copied over.
|
7
|
+
class Captions
|
8
|
+
|
9
|
+
include FilepathHelpers
|
10
|
+
|
11
|
+
def initialize(filename, output_dir)
|
12
|
+
@filename = filename
|
13
|
+
@output_directory = output_dir
|
14
|
+
if vtt_dir_glob.length > 0
|
15
|
+
FileUtils.mkdir_p vtt_output_directory
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def copy
|
20
|
+
vtt_dir_glob.each do |vtt|
|
21
|
+
# vtt_basename = File.basename vtt
|
22
|
+
vtt_filename = File.join vtt_output_directory, 'captions.vtt'
|
23
|
+
FileUtils.cp vtt, vtt_filename
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def vtt_dir_glob
|
28
|
+
Dir.glob vtt_file_glob
|
29
|
+
end
|
30
|
+
|
31
|
+
# TODO: actually search for more than one VTT file
|
32
|
+
def vtt_file_glob
|
33
|
+
File.join filename_directory, "#{basename}.vtt"
|
34
|
+
end
|
35
|
+
|
36
|
+
def vtt_output_directory
|
37
|
+
File.join @output_directory, 'vtt'
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
data/lib/abrizer/cli.rb
CHANGED
@@ -2,11 +2,11 @@ require 'thor'
|
|
2
2
|
module Abrizer
|
3
3
|
class CLI < Thor
|
4
4
|
|
5
|
-
desc 'all <filepath> <output_directory>', '
|
6
|
-
def all(filepath, output_dir
|
5
|
+
desc 'all <filepath> <output_directory> <base_url>', 'Run all processes including creating ABR streams, progressive download versions, and images and video sprites.'
|
6
|
+
def all(filepath, output_dir, base_url)
|
7
7
|
filepath = File.expand_path filepath
|
8
8
|
output_dir = File.expand_path output_dir
|
9
|
-
Abrizer::All.new(filepath, output_dir).run
|
9
|
+
Abrizer::All.new(filepath, output_dir, base_url).run
|
10
10
|
end
|
11
11
|
|
12
12
|
desc 'abr <filepath> <output_directory>', 'From file create ABR streams, includes processing MP4 adaptations for packaging'
|
@@ -76,6 +76,26 @@ module Abrizer
|
|
76
76
|
Abrizer::Sprites.new(filepath, output_dir).create
|
77
77
|
end
|
78
78
|
|
79
|
+
desc 'poster <output_directory>', 'Copy over a temporary poster image based on the sprite images'
|
80
|
+
def poster(output_dir=nil)
|
81
|
+
output_dir = File.expand_path output_dir
|
82
|
+
Abrizer::TemporaryPoster.new(output_dir).copy
|
83
|
+
end
|
84
|
+
|
85
|
+
desc 'captions <filepath> <output_directory>', 'Captions and subtitles files with the same basename as the video file and with a .vtt extension are copied over into the output directory'
|
86
|
+
def captions(filepath, output_dir=nil)
|
87
|
+
filepath = File.expand_path filepath
|
88
|
+
output_dir = File.expand_path output_dir
|
89
|
+
Abrizer::Captions.new(filepath, output_dir).copy
|
90
|
+
end
|
91
|
+
|
92
|
+
desc 'canvas <filepath> <output_directory> <base_url>', 'Creates a IIIF Canvas JSON-LD document as an API into the resources'
|
93
|
+
def canvas(filepath, output_directory, base_url)
|
94
|
+
filepath = File.expand_path filepath
|
95
|
+
output_directory = File.expand_path output_directory
|
96
|
+
Abrizer::Canvas.new(filepath, output_directory, base_url).create
|
97
|
+
end
|
98
|
+
|
79
99
|
desc 'clean <filepath> <output_directory>', 'Clean up intermediary files'
|
80
100
|
def clean(filepath, output_dir=nil)
|
81
101
|
Abrizer::Cleaner.new(filepath, output_dir).clean
|
@@ -8,7 +8,7 @@ module Abrizer
|
|
8
8
|
|
9
9
|
def get_info
|
10
10
|
@json_result = `#{ffmpeg_info_cmd}`
|
11
|
-
@info =
|
11
|
+
@info = MultiJson.load @json_result
|
12
12
|
end
|
13
13
|
|
14
14
|
def width
|
@@ -19,6 +19,10 @@ module Abrizer
|
|
19
19
|
video_stream['height'] if video_stream
|
20
20
|
end
|
21
21
|
|
22
|
+
def duration
|
23
|
+
video_stream['duration'] if video_stream
|
24
|
+
end
|
25
|
+
|
22
26
|
def display_aspect_ratio #dar
|
23
27
|
dar = video_stream['display_aspect_ratio']
|
24
28
|
sar = video_stream['sample_aspect_ratio']
|
@@ -20,6 +20,10 @@ module Abrizer
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def output_directory_basename
|
24
|
+
File.basename output_directory
|
25
|
+
end
|
26
|
+
|
23
27
|
def filename_directory
|
24
28
|
File.dirname @filename
|
25
29
|
end
|
@@ -29,5 +33,66 @@ module Abrizer
|
|
29
33
|
extname = File.extname @filename
|
30
34
|
File.basename @filename, extname
|
31
35
|
end
|
36
|
+
|
37
|
+
def poster_partial_filepath
|
38
|
+
'poster.jpg'
|
39
|
+
end
|
40
|
+
|
41
|
+
def mpd_partial_filepath
|
42
|
+
'fmp4/stream.mpd'
|
43
|
+
end
|
44
|
+
|
45
|
+
def mpd_filepath
|
46
|
+
File.join output_directory, mpd_partial_filepath
|
47
|
+
end
|
48
|
+
|
49
|
+
def hlsts_partial_filepath
|
50
|
+
'hls/master.m3u8'
|
51
|
+
end
|
52
|
+
|
53
|
+
def hlsts_filepath
|
54
|
+
File.join output_directory, hlsts_partial_filepath
|
55
|
+
end
|
56
|
+
|
57
|
+
def mp4_partial_filepath
|
58
|
+
'progressive.mp4'
|
59
|
+
end
|
60
|
+
|
61
|
+
def mp4_filepath
|
62
|
+
File.join output_directory, mp4_partial_filepath
|
63
|
+
end
|
64
|
+
|
65
|
+
def vp9_partial_filepath
|
66
|
+
'progressive-vp9.webm'
|
67
|
+
end
|
68
|
+
|
69
|
+
def vp9_filepath
|
70
|
+
File.join output_directory, vp9_partial_filepath
|
71
|
+
end
|
72
|
+
|
73
|
+
def canvas_partial_filepath
|
74
|
+
'canvas.json'
|
75
|
+
end
|
76
|
+
|
77
|
+
def canvas_filepath
|
78
|
+
File.join output_directory, canvas_partial_filepath
|
79
|
+
end
|
80
|
+
|
81
|
+
def sprites_partial_filepath
|
82
|
+
'sprites/sprites.vtt'
|
83
|
+
end
|
84
|
+
|
85
|
+
def sprites_filepath
|
86
|
+
File.join output_directory, sprites_partial_filepath
|
87
|
+
end
|
88
|
+
|
89
|
+
def first_image_filepath
|
90
|
+
File.join output_directory, 'sprites/images/img-00001.jpg'
|
91
|
+
end
|
92
|
+
|
93
|
+
def poster_image_filepath
|
94
|
+
File.join output_directory, 'poster.jpg'
|
95
|
+
end
|
96
|
+
|
32
97
|
end
|
33
98
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Abrizer
|
2
|
+
# It is usually better for a human to select a poster image, but we try to
|
3
|
+
# select a temporary one.
|
4
|
+
# Creating sprites leaves some images around so that is a prerequisite for
|
5
|
+
# this step.
|
6
|
+
# TODO: selection of a temporary poster image could be improved
|
7
|
+
class TemporaryPoster
|
8
|
+
|
9
|
+
include FilepathHelpers
|
10
|
+
|
11
|
+
def initialize(output_dir)
|
12
|
+
@output_directory = output_dir
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy
|
16
|
+
FileUtils.cp first_image_filepath, poster_image_filepath
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/abrizer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abrizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Ronallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,7 +95,21 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: video_sprites
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.2.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.2.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: jbuilder
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -109,19 +123,19 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: yajl-ruby
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
131
|
+
version: '0'
|
118
132
|
type: :runtime
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
138
|
+
version: '0'
|
125
139
|
description: Creates adaptive bitrate streams and other delivery derivatives.
|
126
140
|
email:
|
127
141
|
- jronallo@gmail.com
|
@@ -141,6 +155,7 @@ files:
|
|
141
155
|
- ansible/development-playbook.retry
|
142
156
|
- ansible/development-playbook.yml
|
143
157
|
- ansible/development.ini
|
158
|
+
- ansible/roles/apache/tasks/main.yml
|
144
159
|
- ansible/roles/basic-setup/tasks/main.yml
|
145
160
|
- ansible/roles/bento4/tasks/main.yml
|
146
161
|
- ansible/roles/ffmpeg/defaults/main.yml
|
@@ -191,6 +206,8 @@ files:
|
|
191
206
|
- lib/abrizer/adaptation.rb
|
192
207
|
- lib/abrizer/adaptation_finder.rb
|
193
208
|
- lib/abrizer/all.rb
|
209
|
+
- lib/abrizer/canvas.rb
|
210
|
+
- lib/abrizer/captions.rb
|
194
211
|
- lib/abrizer/cleaner.rb
|
195
212
|
- lib/abrizer/cli.rb
|
196
213
|
- lib/abrizer/ffmpeg_processor.rb
|
@@ -204,6 +221,7 @@ files:
|
|
204
221
|
- lib/abrizer/progressive_mp4.rb
|
205
222
|
- lib/abrizer/progressive_vp9.rb
|
206
223
|
- lib/abrizer/sprites.rb
|
224
|
+
- lib/abrizer/temporary_poster.rb
|
207
225
|
- lib/abrizer/version.rb
|
208
226
|
homepage: https://github.com/jronallo/abrizer
|
209
227
|
licenses:
|
@@ -225,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
243
|
version: '0'
|
226
244
|
requirements: []
|
227
245
|
rubyforge_project:
|
228
|
-
rubygems_version: 2.
|
246
|
+
rubygems_version: 2.6.6
|
229
247
|
signing_key:
|
230
248
|
specification_version: 4
|
231
249
|
summary: Creates MPEG-DASH and HLS streams from a video file.
|