ffmprb 0.12.1 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +10 -10
- data/README.md +7 -2
- data/coverage/index.html +2541 -2123
- data/exp/present/Gemfile.lock +2 -2
- data/exp/present/exp/present.rb +8 -2
- data/exp/youtubby/Gemfile +1 -3
- data/exp/youtubby/Gemfile.lock +3 -5
- data/exp/youtubby/exp/gop-raw-cut-rcc-join-you-HD60.rb +356 -0
- data/exp/youtubby/exp/gop-raw-cut-you-HD60 +3 -1
- data/exp/youtubby/exp/gop-raw-cut-you-HD60.rb +191 -63
- data/exp/youtubby/google_youtube.rb +3 -3
- data/ffmprb.gemspec +2 -0
- data/lib/defaults.rb +1 -1
- data/lib/ffmprb/file/sample.rb +15 -7
- data/lib/ffmprb/file.rb +13 -5
- data/lib/ffmprb/filter.rb +19 -7
- data/lib/ffmprb/process/input/chain_base.rb +5 -0
- data/lib/ffmprb/process/input/cut.rb +0 -4
- data/lib/ffmprb/process/input/paced.rb +3 -1
- data/lib/ffmprb/process/input.rb +4 -4
- data/lib/ffmprb/process/output.rb +2 -11
- data/lib/ffmprb/process.rb +22 -13
- data/lib/ffmprb/util/thread.rb +6 -3
- data/lib/ffmprb/util.rb +8 -6
- data/lib/ffmprb/version.rb +1 -1
- metadata +4 -3
data/lib/ffmprb/process.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
module Ffmprb
|
2
4
|
|
3
5
|
class Process
|
@@ -134,6 +136,7 @@ module Ffmprb
|
|
134
136
|
end
|
135
137
|
end
|
136
138
|
|
139
|
+
# TODO ...or... "output label"! (implement intermediate "outputs" through this)
|
137
140
|
def input_label(input)
|
138
141
|
@inputs.index input
|
139
142
|
end
|
@@ -160,11 +163,12 @@ module Ffmprb
|
|
160
163
|
thr = Util::Thread.new main: !parent do
|
161
164
|
proc_vis_node Thread.current
|
162
165
|
# NOTE yes, an exception can occur anytime, and we'll just die, it's ok, see above
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
command do |cmd|
|
167
|
+
opts = {limit: limit, timeout: timeout}
|
168
|
+
opts[:ignore_broken_pipes] = ignore_broken_pipes unless ignore_broken_pipes.nil?
|
169
|
+
Util.ffmpeg(*cmd, **opts).tap do |res|
|
170
|
+
Util::Thread.join_children! limit, timeout: timeout
|
171
|
+
end
|
168
172
|
end
|
169
173
|
proc_vis_node Thread.current, :remove
|
170
174
|
end
|
@@ -174,23 +178,28 @@ module Ffmprb
|
|
174
178
|
private
|
175
179
|
|
176
180
|
def command
|
177
|
-
|
181
|
+
fail "Miserably" unless
|
182
|
+
block_given?
|
183
|
+
Tempfile.create do |tmp_file|
|
184
|
+
yield input_args(tmp_file) + filter_args(tmp_file) + output_args(tmp_file)
|
185
|
+
end
|
178
186
|
end
|
179
187
|
|
180
|
-
def input_args
|
181
|
-
filter_args # NOTE must run first
|
188
|
+
def input_args(script_file=nil)
|
189
|
+
filter_args script_file # NOTE must run first
|
182
190
|
@input_args ||= @inputs.map(&:args).reduce(:+)
|
183
191
|
end
|
184
192
|
|
185
|
-
# NOTE must run first
|
186
|
-
def filter_args
|
193
|
+
# NOTE must run first (which is excusable just because it's private)
|
194
|
+
def filter_args(script_file=nil)
|
187
195
|
@filter_args ||= Filter.complex_args(
|
188
|
-
|
196
|
+
*@outputs.map(&:filters).reduce(:+),
|
197
|
+
script_file: script_file
|
189
198
|
)
|
190
199
|
end
|
191
200
|
|
192
|
-
def output_args
|
193
|
-
filter_args # NOTE must run first
|
201
|
+
def output_args(script_file=nil)
|
202
|
+
filter_args script_file # NOTE must run first
|
194
203
|
@output_args ||= @outputs.map(&:args).reduce(:+)
|
195
204
|
end
|
196
205
|
|
data/lib/ffmprb/util/thread.rb
CHANGED
@@ -59,7 +59,8 @@ module Ffmprb
|
|
59
59
|
@parent.child_lives self
|
60
60
|
Ffmprb.logger.warn "Not the main: false thread run by a #{self.class.name} thread" if main
|
61
61
|
else
|
62
|
-
Ffmprb.logger.warn "Not the main: true thread run by a not #{self.class.name} thread" unless
|
62
|
+
Ffmprb.logger.warn "Not the main: true thread run by a not #{self.class.name} thread" unless
|
63
|
+
main
|
63
64
|
end
|
64
65
|
sync_q.enq :ok
|
65
66
|
Ffmprb.logger.debug{"#{name} thread launched"}
|
@@ -99,7 +100,8 @@ module Ffmprb
|
|
99
100
|
@children_mon.synchronize do
|
100
101
|
Ffmprb.logger.debug{"releasing #{thr.name} thread"}
|
101
102
|
@dead_children_q.enq thr
|
102
|
-
fail "System Error" unless
|
103
|
+
fail "System Error" unless
|
104
|
+
@live_children.delete thr
|
103
105
|
end
|
104
106
|
proc_vis_edge self, thr, :remove
|
105
107
|
end
|
@@ -112,7 +114,8 @@ module Ffmprb
|
|
112
114
|
@dead_children_q.deq
|
113
115
|
end
|
114
116
|
Ffmprb.logger.debug "joining the late #{thr.name} thread"
|
115
|
-
fail "System Error" unless
|
117
|
+
fail "System Error" unless
|
118
|
+
thr.join(timeout) # NOTE should not block
|
116
119
|
end
|
117
120
|
end
|
118
121
|
end
|
data/lib/ffmprb/util.rb
CHANGED
@@ -24,12 +24,14 @@ module Ffmprb
|
|
24
24
|
def ffmpeg(*args, limit: nil, timeout: cmd_timeout, ignore_broken_pipes: true)
|
25
25
|
args = %w[-loglevel debug] + args if
|
26
26
|
Ffmprb.ffmpeg_debug
|
27
|
-
sh
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
sh(
|
28
|
+
*ffmpeg_cmd, *args,
|
29
|
+
output: :stderr,
|
30
|
+
limit: limit,
|
31
|
+
timeout: timeout,
|
32
|
+
ignore_broken_pipes: ignore_broken_pipes,
|
33
|
+
broken_pipe_error_re: FFMPEG_BROKEN_PIPE_ERROR_RE
|
34
|
+
)
|
33
35
|
end
|
34
36
|
|
35
37
|
def sh(*cmd, input: nil, output: :stdout, limit: nil, timeout: cmd_timeout, ignore_broken_pipes: false, broken_pipe_error_re: nil)
|
data/lib/ffmprb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffmprb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Costa Shapiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mkfifo
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- exp/youtubby/README.md
|
190
190
|
- exp/youtubby/bin/up-deps
|
191
191
|
- exp/youtubby/docker-compose.yml
|
192
|
+
- exp/youtubby/exp/gop-raw-cut-rcc-join-you-HD60.rb
|
192
193
|
- exp/youtubby/exp/gop-raw-cut-you-HD60
|
193
194
|
- exp/youtubby/exp/gop-raw-cut-you-HD60.rb
|
194
195
|
- exp/youtubby/exp/media-upload
|
@@ -246,7 +247,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
247
|
requirements:
|
247
248
|
- - ">="
|
248
249
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
250
|
+
version: '2.6'
|
250
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
252
|
requirements:
|
252
253
|
- - ">="
|