eikon 0.1.9 → 0.1.11
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/eikon/version.rb +1 -1
- data/lib/eikon/video_processor.rb +26 -24
- data/lib/eikon.rb +1 -0
- 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: 2f7954d7b98c1d1589778c648f2ccdb1f3bd3a7bfb2b5b96a78b67309c22c13b
|
4
|
+
data.tar.gz: 70691d16384c391b125fcb7be1ebc0ffef570efcd428e56a3f1e401ad6aedf96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9471e14568ca78e34930f6ec33c1464caf66766d0231558737d9645624ad6cf07b1e358b80bf6f4634507477afaed0bb10d218e505b2cd4d791a8019762c085
|
7
|
+
data.tar.gz: 88bbdec7d3e3dd8f937360b609b11451dd69ab2f0f2050623112877e2b0ab8aea6d66b3cf1778065a2a5569f883f959c98ad9c7cb65d2b4ca195b56e024bb544
|
data/Gemfile.lock
CHANGED
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)
|
@@ -40,35 +41,36 @@ module Eikon
|
|
40
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
|
-
if number_of_frames
|
44
|
+
if number_of_frames > 2
|
45
|
+
# number_of_frames = number_of_frames - 2
|
46
|
+
# number_of_frames = 0 if number_of_frames.negative?
|
44
47
|
|
45
|
-
|
48
|
+
# NOTE: This has to be a fraction, not a whole number, but also, never 0
|
49
|
+
fps = (number_of_frames - 2) / total_time # We subtract two because we're taking the start and end
|
46
50
|
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}_%
|
51
|
+
line.run(file_name: @file_name, folder_name: "#{output_folder_path}/#{file_name}_%05d.png")
|
48
52
|
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)
|
53
|
+
line = Terrapin::CommandLine.new("ffmpeg", "-i :file_name -filter:v \"select='gt(scene,0.4)',showinfo\" -vsync 0 :output_directory/:output_file_name")
|
54
|
+
line.run(file_name: @file_name, output_directory: output_folder_path, output_file_name: "#{file_name}_%05d.png")
|
70
55
|
end
|
71
56
|
|
57
|
+
# Screenshot the second second and second to last second
|
58
|
+
# ffmpeg -ss 01:23:45 -i input -frames:v 1 -q:v 2 output.jpg
|
59
|
+
last_time = "#{time_parts[0]}:#{time_parts[1]}:#{(time_parts[2].to_f - 1).abs.floor}"
|
60
|
+
ffmpeg_command = "-ss 00:00:02 -i :file_name " +
|
61
|
+
"-ss :last_time -i :file_name " +
|
62
|
+
"-map 0:v -vframes 1 :output_directory/:output_file_name_start " +
|
63
|
+
"-map 1:v -vframes 1 :output_directory/:output_file_name_end"
|
64
|
+
line = Terrapin::CommandLine.new("ffmpeg", ffmpeg_command)
|
65
|
+
line.run(
|
66
|
+
file_name: @file_name,
|
67
|
+
last_time: last_time,
|
68
|
+
output_directory: output_folder_path,
|
69
|
+
output_file_name_start: "#{file_name}_%05d.png",
|
70
|
+
output_file_name_end: "#{file_name}_%05d.png"
|
71
|
+
)
|
72
|
+
remove_blank_shots(output_folder_path)
|
73
|
+
|
72
74
|
output_folder_path
|
73
75
|
end
|
74
76
|
|
data/lib/eikon.rb
CHANGED
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Guess
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-vips
|