falcon 0.1.2 → 0.1.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.
- data/README.rdoc +6 -6
- data/lib/falcon/encoder.rb +13 -14
- data/lib/falcon/media.rb +1 -1
- data/lib/falcon/profiles.rb +4 -4
- data/lib/falcon/version.rb +1 -1
- metadata +7 -7
data/README.rdoc
CHANGED
@@ -18,13 +18,12 @@ By default avariable two profiles "web_mp4" and "web_ogg":
|
|
18
18
|
|
19
19
|
Falcon::Profile.new("web_mp4", {:player => 'flash', :container => "mp4", :extname => 'mp4',
|
20
20
|
:width => 480, :height => 320, :video_codec => "libx264",
|
21
|
-
:video_bitrate => 500, :fps => 29.97,
|
22
|
-
:
|
23
|
-
|
24
|
-
|
21
|
+
:command => "-vpre slow -crf 22", :video_bitrate => 500, :fps => 29.97,
|
22
|
+
:audio_codec => "libfaac", :audio_bitrate => 128, :audio_sample_rate => 48000})
|
23
|
+
|
25
24
|
Falcon::Profile.new("web_ogg", {:player => 'html5', :container => "ogg", :extname => 'ogv',
|
26
|
-
:width => 480, :height => 320, :video_codec => "libtheora",
|
27
|
-
:video_bitrate =>
|
25
|
+
:width => 480, :height => 320, :video_codec => "libtheora", :command => '-g 300',
|
26
|
+
:video_bitrate => 1000, :fps => 29.97, :audio_codec => "libvorbis",
|
28
27
|
:audio_bitrate => 128, :audio_sample_rate => 48000})
|
29
28
|
|
30
29
|
=== Update profiles
|
@@ -157,3 +156,4 @@ For delayed_job:
|
|
157
156
|
end
|
158
157
|
end
|
159
158
|
|
159
|
+
Copyright © 2011 Aimbulance, released under the MIT license
|
data/lib/falcon/encoder.rb
CHANGED
@@ -62,7 +62,6 @@ module Falcon
|
|
62
62
|
:input_file => input_file,
|
63
63
|
:output_file => output_file,
|
64
64
|
:resolution => self.ffmpeg_resolution
|
65
|
-
#:resolution_and_padding => self.ffmpeg_resolution_and_padding_no_cropping
|
66
65
|
})
|
67
66
|
end
|
68
67
|
|
@@ -133,10 +132,10 @@ module Falcon
|
|
133
132
|
end
|
134
133
|
end
|
135
134
|
|
135
|
+
# Calculate resolution and any padding
|
136
136
|
def ffmpeg_resolution_and_padding_no_cropping(v_width, v_height)
|
137
|
-
|
138
|
-
|
139
|
-
in_h = v_height.to_f #self.video.height.to_f
|
137
|
+
in_w = v_width.to_f
|
138
|
+
in_h = v_height.to_f
|
140
139
|
out_w = self.width.to_f
|
141
140
|
out_h = self.height.to_f
|
142
141
|
|
@@ -144,35 +143,35 @@ module Falcon
|
|
144
143
|
aspect = in_w / in_h
|
145
144
|
aspect_inv = in_h / in_w
|
146
145
|
rescue
|
147
|
-
|
148
|
-
@ffmpeg_resolution =
|
146
|
+
Rails.logger.error "Couldn't do w/h to caculate aspect. Just using the output resolution now."
|
147
|
+
@ffmpeg_resolution = "#{self.width}x#{self.height}"
|
149
148
|
return
|
150
149
|
end
|
151
150
|
|
152
151
|
height = (out_w / aspect.to_f).to_i
|
153
152
|
height -= 1 if height % 2 == 1
|
154
153
|
|
155
|
-
@ffmpeg_resolution =
|
154
|
+
@ffmpeg_resolution = "#{self.width}x#{height}"
|
156
155
|
|
157
156
|
# Keep the video's original width if the height
|
158
157
|
if height > out_h
|
159
158
|
width = (out_h / aspect_inv.to_f).to_i
|
160
159
|
width -= 1 if width % 2 == 1
|
161
160
|
|
162
|
-
@ffmpeg_resolution =
|
161
|
+
@ffmpeg_resolution = "#{width}x#{self.height}"
|
163
162
|
self.width = width
|
164
|
-
self.save
|
163
|
+
self.save(:validate => false)
|
165
164
|
# Otherwise letterbox it
|
166
165
|
elsif height < out_h
|
167
166
|
pad = ((out_h - height.to_f) / 2.0).to_i
|
168
167
|
pad -= 1 if pad % 2 == 1
|
169
|
-
@ffmpeg_padding =
|
168
|
+
@ffmpeg_padding = "-vf pad=#{self.width}:#{height + pad}:0:#{pad / 2}"
|
170
169
|
end
|
171
170
|
end
|
172
171
|
|
173
|
-
def encode_source
|
174
|
-
|
175
|
-
ffmpeg_resolution_and_padding_no_cropping(
|
172
|
+
def encode_source
|
173
|
+
stream = transcoder.source.video_stream
|
174
|
+
ffmpeg_resolution_and_padding_no_cropping(stream.width, stream.height)
|
176
175
|
options = self.profile_options(self.source_path, output_path)
|
177
176
|
|
178
177
|
begin
|
@@ -200,7 +199,7 @@ module Falcon
|
|
200
199
|
end
|
201
200
|
end
|
202
201
|
|
203
|
-
command <<
|
202
|
+
command << self.ffmpeg_padding
|
204
203
|
command << "-y"
|
205
204
|
end
|
206
205
|
rescue ::WebVideo::CommandLineError => e
|
data/lib/falcon/media.rb
CHANGED
@@ -115,7 +115,7 @@ module Falcon
|
|
115
115
|
|
116
116
|
# Yield generated screenshots and remove them
|
117
117
|
def screenshots(&block)
|
118
|
-
Dir.glob(
|
118
|
+
Dir.glob(File.join(output_directory, '*.{jpg,JPG}').to_s).each do |filepath|
|
119
119
|
yield filepath
|
120
120
|
FileUtils.rm(filepath, :force => true)
|
121
121
|
end
|
data/lib/falcon/profiles.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Falcon::Profile.new("web_mp4", {:player => 'flash', :container => "mp4", :extname => 'mp4',
|
2
2
|
:width => 480, :height => 320, :video_codec => "libx264",
|
3
|
-
:video_bitrate => 500, :fps => 29.97,
|
4
|
-
:audio_bitrate => 128, :audio_sample_rate => 48000})
|
3
|
+
:command => "-vpre slow -crf 22", :video_bitrate => 500, :fps => 29.97,
|
4
|
+
:audio_codec => "libfaac", :audio_bitrate => 128, :audio_sample_rate => 48000})
|
5
5
|
|
6
6
|
Falcon::Profile.new("web_ogg", {:player => 'html5', :container => "ogg", :extname => 'ogv',
|
7
|
-
:width => 480, :height => 320, :video_codec => "libtheora",
|
8
|
-
:video_bitrate =>
|
7
|
+
:width => 480, :height => 320, :video_codec => "libtheora", :command => '-g 300',
|
8
|
+
:video_bitrate => 1000, :fps => 29.97, :audio_codec => "libvorbis",
|
9
9
|
:audio_bitrate => 128, :audio_sample_rate => 48000})
|
data/lib/falcon/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-30 00:00:00 +03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 23
|
30
30
|
segments:
|
31
31
|
- 1
|
32
32
|
- 1
|
33
|
-
-
|
34
|
-
version: 1.1.
|
33
|
+
- 2
|
34
|
+
version: 1.1.2
|
35
35
|
name: web_video
|
36
36
|
version_requirements: *id001
|
37
37
|
prerelease: false
|