ffmprb 0.9.3 → 0.9.4

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: b7ad97d1cd5c5f9689791939bac8be4036bba88e
4
- data.tar.gz: fa917b25a9eb5756515ce122a842ca267057f8e3
3
+ metadata.gz: 191c7811867d45ef87f8256b249142c64fd9d566
4
+ data.tar.gz: 9b9bd63d84fe2b8b0df0acb32c3905686addf79d
5
5
  SHA512:
6
- metadata.gz: 8c2c21e9616b2cb086d211d8e8f4f973764e7c950a664a20d36dfdc84ece7e4250a69413883b19fd826ff0af6d5b4df462f8c4223ca38ea48c0a4dda3697c497
7
- data.tar.gz: 2e51ac9a3da91b19a1ae643425777db4bcd3ec4d88cf1fecf2f8850b7a62b3581760b5745de931e6cbcd80d48fc271cb4644ac76b1daa2a334aeb197c2c59749
6
+ metadata.gz: 48a577a5ff1635a741325ad7ee72d74a41ab3fc35320cf9e05888e8b073752ccc1567e861eb59e506ae049096a4881cc2abec0f0f36988c21d8270ed91305944
7
+ data.tar.gz: 3e060ba0f8e3b3325aad8cf063cf06c4cd93f6d176b1e51a14a910602ece387e1f6ed2eb4b78a76d8116eed389dad741e017fc246d6be3d3cb9d7565c1d4d94e
data/lib/defaults.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  module Ffmprb
2
2
 
3
+ File.image_extname_regex = /^\.(jpe?g|a?png|y4m)$/i
4
+ File.sound_extname_regex = /^\.(mp3|wav)$/i
5
+ File.movie_extname_regex = /^\.(mp4|flv|mov)$/i
6
+
3
7
  Filter.silence_noise_max_db = -40
4
8
 
5
9
  Process.duck_audio_silent_min = 3
data/lib/ffmprb/file.rb CHANGED
@@ -8,6 +8,8 @@ module Ffmprb
8
8
 
9
9
  class << self
10
10
 
11
+ attr_accessor :image_extname_regex, :sound_extname_regex, :movie_extname_regex
12
+
11
13
  def threaded_buffered_fifo(extname='.tmp')
12
14
  input_fifo_file = temp_fifo(extname)
13
15
  output_fifo_file = temp_fifo(extname)
@@ -84,6 +86,18 @@ module Ffmprb
84
86
  }
85
87
  end
86
88
 
89
+ def image?(extname)
90
+ extname =~ image_extname_regex
91
+ end
92
+
93
+ def sound?(extname)
94
+ extname =~ sound_extname_regex
95
+ end
96
+
97
+ def movie?(extname)
98
+ extname =~ movie_extname_regex
99
+ end
100
+
87
101
  end
88
102
 
89
103
 
@@ -112,9 +126,9 @@ module Ffmprb
112
126
  def channel?(medium)
113
127
  case medium
114
128
  when :video
115
- image_extname? || movie_extname?
129
+ self.class.image?(extname) || self.class.movie?(extname)
116
130
  when :audio
117
- sound_extname? || movie_extname?
131
+ self.class.sound?(extname) || self.class.movie?(extname)
118
132
  end
119
133
  end
120
134
 
@@ -173,18 +187,6 @@ module Ffmprb
173
187
  end
174
188
  end
175
189
 
176
- def image_extname?
177
- extname =~ /^\.(jpe?g|a?png|y4m)$/i
178
- end
179
-
180
- def sound_extname?
181
- extname =~ /^\.(mp3|wav)$/i
182
- end
183
-
184
- def movie_extname?
185
- extname =~ /^\.(mp4|flv)$/i
186
- end
187
-
188
190
  end
189
191
 
190
192
  end
@@ -6,8 +6,18 @@ module Ffmprb
6
6
 
7
7
  class << self
8
8
 
9
- def audio_cmd_options(audio=Process.output_audio_options)
10
- audio ||= {}
9
+ # XXX check for unknown options
10
+
11
+ def video_cmd_options(video=nil)
12
+ video = Process.output_video_options.merge(video.to_h || {})
13
+ [].tap do |options|
14
+ options.concat %W[-c:v #{video[:encoder]}] if video[:encoder]
15
+ options.concat %W[-pix_fmt #{video[:pixel_format]}] if video[:pixel_format]
16
+ end
17
+ end
18
+
19
+ def audio_cmd_options(audio=nil)
20
+ audio = Process.output_audio_options.merge(audio.to_h || {})
11
21
  [].tap do |options|
12
22
  options.concat %W[-c:a #{audio[:encoder]}] if audio[:encoder]
13
23
  end
@@ -278,6 +288,7 @@ module Ffmprb
278
288
  channel_lbls.each do |channel_lbl|
279
289
  options << '-map' << "[#{channel_lbl}]"
280
290
  end
291
+ options.concat self.class.video_cmd_options(channel :video) if channel? :video
281
292
  options.concat self.class.audio_cmd_options(channel :audio) if channel? :audio
282
293
  options << io.path
283
294
  end
@@ -1,3 +1,3 @@
1
1
  module Ffmprb
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffmprb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - showbox.com
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-11-16 00:00:00.000000000 Z
12
+ date: 2015-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mkfifo