easyvideo_utils 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cf96bd7cae7c924f5bc6259a374b4f3869f5a99aa936f9bc965ade2678b3301
4
- data.tar.gz: 2794a519340d3142e0958dd35b46d9f62776978ea1ecd3835370afab929f260d
3
+ metadata.gz: 3bccc4208ba0387eed19fa49dadbf1e8ce9f1e6c23a03d2d0ffe06de13c24066
4
+ data.tar.gz: e96dae4b15d3bd87c639bdb18d4625621b1751ae61c205d0217ca9de6219a8e4
5
5
  SHA512:
6
- metadata.gz: e705fe92de0df9800359f0a39b0bec628c9b423a4e8ab0371a4d6bb65d45d01be14b0c1e719243a0d8df693e871db5209028a5009d70caf510dd668cb8a78de8
7
- data.tar.gz: 2bea5237a862fb1de00261d4c43a91dd7a1215e558f63eab8b2045d587c2c27f6e054a6d5ed4039bf0c6cb0357b723ceb1903dd88551d6bbadac5b0c5d365188
6
+ metadata.gz: be9541a058aa9092a65c377d07deda69804d71ce7481997766c09e5bfe0ba7312c109da1ed1d51c5117abae494eb7a9f8fb7d367b5c7ec872f40c17569e5b726
7
+ data.tar.gz: accc3485844c6680d13e24c286ff987301d2727c5159e6c475a1ad0c909eff965f6d92568b493da077b096da8d659e444d93b0a04a713fee5edd7ba97acb592d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -7,7 +7,14 @@ require 'subunit'
7
7
 
8
8
 
9
9
  # requirements:
10
- # `apt-get install mplayer ffmpeg vorbis-tools`exiftool
10
+ # `apt-get install mplayer ffmpeg vorbis-tools`exiftool libav-tools
11
+
12
+ # note: Although this gem tries to be full-proof it's dependent upon the
13
+ # command-line tools to do the heavy lifting, as a result is prone
14
+ # to nuisance factors.
15
+ # tip: instead of using transcode, try specifing the target encoding based on
16
+ # the extension type when using multiple
17
+ # operations e.g. EasyVideoUtils.new('vid2.avi', 'vid3.mp4').resize
11
18
 
12
19
 
13
20
  module CommandHelper
@@ -42,12 +49,13 @@ class EasyVideoUtils
42
49
  * create_poster # Video created from audio file + static image
43
50
  * create_slideshow # Combines images to create a video. Defaults to 5 seconds per image
44
51
  * extract_images # Extracts images at 1 FPS by default
52
+ * grab_image # grabs a single image at 1 second in by default
45
53
  * play # plays the video using mplayer
46
54
  * preview # plays the video using ffplay
47
55
  * record # alias for capture
48
56
  * remove_audio # removes the audio track from a video
49
57
  * remove_video # removes the video track from a video. Output file would be an mp3.
50
- * resize # resize to 720p
58
+ * resize # resize to 320x240
51
59
  * scale # alias for resize
52
60
  * slowdown # slows a viedo down. Defaults to x2 (half-speed)
53
61
  * speedup # speed a video up. Defaults to x2 (twice as fast)
@@ -165,6 +173,10 @@ class EasyVideoUtils
165
173
  command = "ffmpeg -i #{@file_in} -r #{rate} -f image2 image-%2d#{ext}"
166
174
  run command, show
167
175
  end
176
+
177
+ def grab_image(start_time=1, show: false)
178
+ command = "avconv -i #{@file_in} -ss #{start_time.to_s} -frames:v 1 #{@file_out}"
179
+ end
168
180
 
169
181
  def play(show: false)
170
182
  command = "mplayer #{@file_out}"
@@ -189,12 +201,13 @@ class EasyVideoUtils
189
201
  run command, show
190
202
  end
191
203
 
192
- # Resize avi to 720p
204
+ # Resize e.g. to 320x240
193
205
  #
194
- def resize(scale='720', show: false)
195
- command = "ffmpeg -i #{@file_in} -vf scale=\"#{scale}:-1\" #{@file_out} -y"
206
+ def resize(scale='320x240', show: false)
207
+ command = "avconv -i #{@file_in} -s #{scale} #{@file_out} -y"
196
208
  run command, show
197
209
  end
210
+
198
211
 
199
212
  alias scale resize
200
213
 
@@ -240,19 +253,15 @@ class EasyVideoUtils
240
253
  alias convert transcode
241
254
 
242
255
  # Trim the start and end of the video
243
- # times are expressed in human time format e.g. '1m 4s', '2m 30'
256
+ # times can be expressed in human time format e.g. '1m 4s', '2m 30'
244
257
  #
245
- def trim(start_time, end_time, show: false)
258
+ def trim(start_time, duration, show: false)
246
259
 
247
- t1, t2 = [start_time, end_time].map do |s|
248
-
249
- "%02d:%02d:%02d" % (s.sub(/m/,'\00s').split(/\D/).reverse + [0,0])\
250
- .take(3).reverse
251
-
252
- end
260
+ t1 = "%02d:%02d:%02d" % (start_time.to_s.sub(/m/,'\00s').split(/\D/)\
261
+ .reverse + [0,0]).take(3).reverse
253
262
 
254
- command = "ffmpeg -i #{@file_in} -ss #{t1} -t #{t2} -async 1 " +
255
- "#{@file_out} -y"
263
+ command = "avconv -i #{@file_in} -ss #{t1} -t #{duration.to_s} " +
264
+ "-codec copy #{@file_out}"
256
265
  run command, show
257
266
 
258
267
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyvideo_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  iOODRzCT1NjcNTH5nzIOVNDgsjVdBcyabDtEoJ+ABRBRC3QbmGexUCnpCQVsGRJh
36
36
  aGOV1YBw3DOVQYevaOX+Vxuw
37
37
  -----END CERTIFICATE-----
38
- date: 2019-05-07 00:00:00.000000000 Z
38
+ date: 2019-11-29 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: c32
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.1
106
+ rubygems_version: 3.0.3
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: A wrapper for ffmpeg to make basic video editing easier.
metadata.gz.sig CHANGED
Binary file