evideo 0.1.4 → 0.1.5
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/evideo.rb +17 -6
- data/lib/evideo/hrvprocessa.rb +29 -20
- data/lib/evideo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4f3dc6fd106de062e6fe2a03dacbf50d69cff96fbbeeb3043f69fc90df5c9d5
|
4
|
+
data.tar.gz: bf3fc236630746840ac5679d11079d26862cee34f3b87cac669c57e846bac095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9523d0dc0f3d496af26cfce9f348cd354d817171e825a23171547f14265dc85119174e3a355179ae3aa485a6c0207e771c5c68b7363fda9a544c801dfb51cdc
|
7
|
+
data.tar.gz: 2b86b8e354e57a1663fc75acd1d476a05d0ccde8e482a01f6b53d75f39629392a3d8b47604ebe968fafa96f826bc51d4655caca4928d5417c00e010835aec30d
|
data/Gemfile.lock
CHANGED
data/lib/evideo.rb
CHANGED
@@ -18,22 +18,33 @@ module Evideo
|
|
18
18
|
desc 'conv', 'converte videos'
|
19
19
|
option :o, banner: 'OUT', default: 'out',
|
20
20
|
desc: 'Pasta destino'
|
21
|
+
option :t, type: :boolean, default: false,
|
22
|
+
desc: 'Processa somente segundos para teste'
|
21
23
|
# Processa videos
|
22
24
|
def conv
|
23
|
-
|
24
|
-
|
25
|
-
HRVideo.new(f).processa(dar, options[:o], dar.first)
|
25
|
+
Dir.glob("#{fin}/*.???").sort.each do |f|
|
26
|
+
HRVideo.new(f).processa(options, fout)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
30
|
desc 'test', 'testa videos'
|
30
31
|
# Analisa videos
|
31
32
|
def test
|
32
|
-
|
33
|
-
|
34
|
-
HRVideo.new(f).testa(dar, options[:o])
|
33
|
+
Dir.glob("#{fin}/*.???").sort.each do |f|
|
34
|
+
HRVideo.new(f).testa(options)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
default_task :conv
|
38
|
+
no_commands do
|
39
|
+
# @return [String] pasta absoluta origem dos videos
|
40
|
+
def fin
|
41
|
+
"#{options[:d].first}/#{options[:i]}"
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [String] pasta absoluta destino dos videos
|
45
|
+
def fout
|
46
|
+
"#{options[:d].first}/#{options[:o]}"
|
47
|
+
end
|
48
|
+
end
|
38
49
|
end
|
39
50
|
end
|
data/lib/evideo/hrvprocessa.rb
CHANGED
@@ -9,7 +9,7 @@ module Evideo
|
|
9
9
|
def show
|
10
10
|
return video unless @probe
|
11
11
|
|
12
|
-
"tempo: #{duration} rate: #{bitrate}"
|
12
|
+
"tempo: #{duration} rate: #{bitrate} ratio: #{ratio} height: #{height}"
|
13
13
|
end
|
14
14
|
|
15
15
|
# Testa validade video original
|
@@ -18,6 +18,7 @@ module Evideo
|
|
18
18
|
def ofok?
|
19
19
|
return false unless (bitrate < 3000 && ext == '.mp4') ||
|
20
20
|
Time.parse(duration) < Time.parse('00:01:00')
|
21
|
+
return false unless ratio == '16:9' && height > 480
|
21
22
|
|
22
23
|
puts "rm \"#{video}\" # #{show}"
|
23
24
|
true
|
@@ -58,16 +59,16 @@ module Evideo
|
|
58
59
|
|
59
60
|
# @return [String] aspect ratio comando conversao
|
60
61
|
def aspect
|
61
|
-
if ratio == '0:1' then
|
62
|
+
if ratio == '0:1' then height < 720 ? '' : ' -aspect 16:9'
|
62
63
|
else " -aspect #{ratio}"
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
67
|
# @return [String] video dimensions comando conversao
|
67
68
|
def dimension
|
68
|
-
if
|
69
|
-
elsif
|
70
|
-
else
|
69
|
+
if height < 480 then ' -s hd480'
|
70
|
+
elsif height <= 720 then ' -s hd720'
|
71
|
+
else ' -s hd1080'
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -76,8 +77,11 @@ module Evideo
|
|
76
77
|
"ffprobe -hide_banner -show_streams \"#{video}\" 2>&1|grep -v title"
|
77
78
|
end
|
78
79
|
|
80
|
+
# Comando para processar videos
|
81
|
+
#
|
82
|
+
# @param [String] tempo do video processato
|
79
83
|
# @return [String] comando conversao
|
80
|
-
def mpeg
|
84
|
+
def mpeg(tempo)
|
81
85
|
"ffmpeg #{geral} -i \"#{video}\" -y -an " +
|
82
86
|
# framerate & bitrate
|
83
87
|
"-r #{[fps, 25].min} -b:v #{[bitrate, 2000].min}k" +
|
@@ -85,28 +89,33 @@ module Evideo
|
|
85
89
|
' -metadata title= -metadata artist= -metadata comment=' \
|
86
90
|
' -metadata major_brand= -metadata compatible_brands=' +
|
87
91
|
# para teste produz somente segundos
|
88
|
-
|
89
|
-
''
|
92
|
+
tempo
|
90
93
|
end
|
91
94
|
|
92
95
|
# Processa videos
|
93
96
|
#
|
94
|
-
# @param [
|
95
|
-
# @
|
96
|
-
# @
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
# @param [Hash] opcoes parametrizacao
|
98
|
+
# @option opcoes [Array<String>] :d locais onde procurar videos
|
99
|
+
# @option opcoes [<String>] :i pasta origem dos videos
|
100
|
+
# @option opcoes [<String>] :o pasta destino dos videos
|
101
|
+
# @option opcoes [<Boolean>] :t processa somente segundos para teste
|
102
|
+
# @param [String] out pasta destino dos videos absoluta
|
103
|
+
def processa(opcoes, out)
|
104
|
+
return if ofok? || vdok?(opcoes[:d], opcoes[:o])
|
105
|
+
|
106
|
+
system mpeg(opcoes[:t] ? ' -t 20' : '') + " #{out}/#{base}.mp4"
|
107
|
+
vfok?(HRVideo.new("#{out}/#{base}.mp4"))
|
102
108
|
end
|
103
109
|
|
104
110
|
# Testa videos
|
105
111
|
#
|
106
|
-
# @param [
|
107
|
-
# @
|
108
|
-
|
109
|
-
|
112
|
+
# @param [Hash] opcoes parametrizacao
|
113
|
+
# @option opcoes [Array<String>] :d locais onde procurar videos
|
114
|
+
# @option opcoes [<String>] :i pasta origem dos videos
|
115
|
+
# @option opcoes [<String>] :o pasta destino dos videos
|
116
|
+
# @option opcoes [<Boolean>] :t processa somente segundos para teste
|
117
|
+
def testa(opcoes)
|
118
|
+
return if ofok? || vdok?(opcoes[:d], opcoes[:o])
|
110
119
|
|
111
120
|
puts "ls \"#{video}\" # #{show}"
|
112
121
|
end
|
data/lib/evideo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evideo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hernâni Rodrigues Vaz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|