eikon 0.1.8 → 0.1.10
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 +1 -0
- data/Gemfile.lock +3 -1
- data/lib/eikon/version.rb +1 -1
- data/lib/eikon/video_processor.rb +27 -26
- 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: 3953b63ceee83d454dbd4713f71df4d9a0951a93a4237a17fcba4c6d3acd87fb
|
4
|
+
data.tar.gz: 6dc06db31ae3ca79620a027e51444b5a41dfff619415fec10ba6d9eb51504c9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e58a8eeecd90dd10dfd8f1f466dc3e15065bca99e94fdba5f8d85fde6495d0efaa3cabe10b6a237c2095df73a5f9a446639dd59fa244660df9987ca9ecca6305
|
7
|
+
data.tar.gz: 854cc94f57d7249256db6ae866a46ffffdb97da483429353667ad71a0c5410586c1d22ab7180dfbf52074e037f42f9c3c0cc11e25fef25955e3343c7950cc0fa
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eikon (0.1.
|
4
|
+
eikon (0.1.10)
|
5
5
|
ruby-vips (~> 2.1)
|
6
6
|
sorbet-runtime (>= 0.5.9204)
|
7
7
|
terrapin (~> 0.6.0)
|
@@ -107,6 +107,7 @@ GEM
|
|
107
107
|
rubocop-packaging (~> 0.5)
|
108
108
|
rubocop-performance (~> 1.11)
|
109
109
|
rubocop-rails (~> 2.0)
|
110
|
+
ruby-prof (1.6.3)
|
110
111
|
ruby-progressbar (1.11.0)
|
111
112
|
ruby-vips (2.1.4)
|
112
113
|
ffi (~> 1.12)
|
@@ -166,6 +167,7 @@ DEPENDENCIES
|
|
166
167
|
rubocop (~> 1.27)
|
167
168
|
rubocop-rails
|
168
169
|
rubocop-rails_config
|
170
|
+
ruby-prof (~> 1.6)
|
169
171
|
ruby-vips
|
170
172
|
sorbet-static-and-runtime
|
171
173
|
tapioca
|
data/lib/eikon/version.rb
CHANGED
@@ -15,6 +15,7 @@ module Eikon
|
|
15
15
|
@file_name = T.let(file_name, String)
|
16
16
|
end
|
17
17
|
|
18
|
+
# Note, this isn't guranteed to give the number of frames since we remove blank images
|
18
19
|
sig { params(number_of_frames: Integer).returns(String) }
|
19
20
|
def split_video_into_images(number_of_frames = 0)
|
20
21
|
file_name = get_file_name(@file_name)
|
@@ -35,40 +36,40 @@ module Eikon
|
|
35
36
|
|
36
37
|
# Turn the time into total seconds (with two points of precision)
|
37
38
|
time_parts = time.split(":")
|
38
|
-
total_time =
|
39
|
-
total_time +=
|
40
|
-
total_time +=
|
39
|
+
total_time = time_parts[0].to_i * 60 * 60 # Hours
|
40
|
+
total_time += time_parts[1].to_i * 60 # Minutes
|
41
|
+
total_time += time_parts[2].to_f # Seconds
|
41
42
|
|
42
43
|
# Figure out the number of frames per minute given the number of frames we want, default to every ten seconds out of sixty
|
43
44
|
if number_of_frames.positive?
|
45
|
+
number_of_frames = number_of_frames - 2
|
46
|
+
number_of_frames = 0 if number_of_frames.negative?
|
44
47
|
|
45
|
-
fps = number_of_frames / total_time
|
48
|
+
fps = (number_of_frames - 2) / total_time # We subtract two because we're taking the start and end
|
46
49
|
line = Terrapin::CommandLine.new("ffmpeg", "-i :file_name -vf fps=#{fps} :folder_name")
|
47
|
-
line.run(file_name: @file_name, folder_name: "#{output_folder_path}/#{file_name}_%
|
50
|
+
line.run(file_name: @file_name, folder_name: "#{output_folder_path}/#{file_name}_%05d.png")
|
48
51
|
else
|
49
|
-
|
50
|
-
line
|
51
|
-
line.run(file_name: @file_name, output_directory: output_folder_path)
|
52
|
-
|
53
|
-
# Screenshot the second second and second to last second
|
54
|
-
# ffmpeg -ss 01:23:45 -i input -frames:v 1 -q:v 2 output.jpg
|
55
|
-
last_time = "#{time_parts[0]}:#{time_parts[1]}:#{(time_parts[2].to_f - 1).abs.floor}"
|
56
|
-
ffmpeg_command = "-ss 00:00:02 -i :file_name " +
|
57
|
-
"-ss :last_time -i :file_name " +
|
58
|
-
"-map 0:v -vframes 1 :output_directory/:output_file_name_start " +
|
59
|
-
"-map 1:v -vframes 1 :output_directory/:output_file_name_end"
|
60
|
-
line = Terrapin::CommandLine.new("ffmpeg", ffmpeg_command)
|
61
|
-
line.run(
|
62
|
-
file_name: @file_name,
|
63
|
-
last_time: last_time,
|
64
|
-
output_directory: output_folder_path,
|
65
|
-
output_file_name_start: "#{SecureRandom.uuid}.png",
|
66
|
-
output_file_name_end: "#{SecureRandom.uuid}.png"
|
67
|
-
)
|
68
|
-
|
69
|
-
remove_blank_shots(output_folder_path)
|
52
|
+
line = Terrapin::CommandLine.new("ffmpeg", "-i :file_name -filter:v \"select='gt(scene,0.4)',showinfo\" -vsync 0 :output_directory/:output_file_name")
|
53
|
+
line.run(file_name: @file_name, output_directory: output_folder_path, output_file_name: "#{file_name}_%05d.png")
|
70
54
|
end
|
71
55
|
|
56
|
+
# Screenshot the second second and second to last second
|
57
|
+
# ffmpeg -ss 01:23:45 -i input -frames:v 1 -q:v 2 output.jpg
|
58
|
+
last_time = "#{time_parts[0]}:#{time_parts[1]}:#{(time_parts[2].to_f - 1).abs.floor}"
|
59
|
+
ffmpeg_command = "-ss 00:00:02 -i :file_name " +
|
60
|
+
"-ss :last_time -i :file_name " +
|
61
|
+
"-map 0:v -vframes 1 :output_directory/:output_file_name_start " +
|
62
|
+
"-map 1:v -vframes 1 :output_directory/:output_file_name_end"
|
63
|
+
line = Terrapin::CommandLine.new("ffmpeg", ffmpeg_command)
|
64
|
+
line.run(
|
65
|
+
file_name: @file_name,
|
66
|
+
last_time: last_time,
|
67
|
+
output_directory: output_folder_path,
|
68
|
+
output_file_name_start: "#{file_name}_%05d.png",
|
69
|
+
output_file_name_end: "#{file_name}_%05d.png"
|
70
|
+
)
|
71
|
+
remove_blank_shots(output_folder_path)
|
72
|
+
|
72
73
|
output_folder_path
|
73
74
|
end
|
74
75
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eikon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Guess
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-vips
|