carrierwave_streamio_ffmpeg 0.0.1 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae25ed6753db25c448b8fb3130e6a542becf9be3
4
- data.tar.gz: e485a824d8f51f0df98158923a04a636935a7ae4
3
+ metadata.gz: 04cd0f71447efa4f82c579e97d7114ff51cc3abe
4
+ data.tar.gz: 6d748b21df60d3df5b21f51e9c57a4b790cce74e
5
5
  SHA512:
6
- metadata.gz: b6be2986f7ec59f9fc7410d1b341e139e5ba052f65eac6a9a46a1a663115544d3a95030975ea6415d878dd482bb0b424ef0e0c2672a4eff78d909e3eac6436d9
7
- data.tar.gz: c21c83dc462411f648a8d5efed2c195cacfd3fc22d0c7f7bd2077d0ebeeaa60b92f269877f7e1984bd7aced78f9d23064cb899414a69f7206845af87d329bb22
6
+ metadata.gz: 8d0cd0fb44e8d1ee1b60f3b8b80dab711b9d0d711032b3c80e244c844475d7186509da945099f70a94b6914e7aa752da5916664949918b0c2725a2e91e7d087a
7
+ data.tar.gz: 1c3bab406e282a29a656bb11e1b0f0c00d2113a5516b60b5bafc2e34a671802b19955d397ecaba8ba1bb56af41ccd722f5d8d373acb6b48819e210122e71da25
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  ## Installation
2
3
 
3
4
  Add this line to your application's Gemfile:
@@ -3,21 +3,22 @@ require 'carrierwave_streamio_ffmpeg/options'
3
3
 
4
4
  module CarrierwaveStreamioFfmpeg
5
5
 
6
- def encode(format, opts = {})
7
- process encode: [ format, opts ]
6
+ def encode(opts = {})
7
+ process encode: [ opts ]
8
8
  end
9
9
 
10
10
  def movie(path)
11
11
  ::FFMPEG::Movie.new path
12
12
  end
13
13
 
14
- def encode(format, opts = {})
15
- tmp_path = File.join(File.dirname(current_path), "tmp_file.#{format}")
14
+ def encode(opts = {})
15
+ tmp_path = File.join(File.dirname(current_path), "tmp_file.#{opts[:format]}")
16
16
  file = movie(current_path)
17
+ preserve_aspect_ratio = opts[:preserve_aspect_ratio]
17
18
  options = CarrierwaveStreamioFfmpeg::Options.new
18
19
  file.transcode(tmp_path,
19
20
  options.video_options(file, opts) ,
20
- options.transcoder_options(opts))
21
+ options.transcoder_options(preserve_aspect_ratio))
21
22
  File.rename(tmp_path, current_path)
22
23
  end
23
24
  end
@@ -5,7 +5,7 @@ module CarrierwaveStreamioFfmpeg
5
5
  opts[:resolution] = set_file_resolution(opts, file)
6
6
  opts[:video_bitrate] = set_file_quality(opts, file)
7
7
  opts[:threads] = 4
8
- format = opts(:format)
8
+ format = opts[:format]
9
9
  opts = opts.except(:quality, :preserve_aspect_ratio, :format)
10
10
  opts.merge!(codec(format))
11
11
  end
@@ -54,13 +54,13 @@ module CarrierwaveStreamioFfmpeg
54
54
  { video_codec: 'libtheora',
55
55
  audio_codec: 'libvorbis' }
56
56
  else
57
- raise CarrierWave::ProcessingError.new("Unsupported video format. Error: #{e}")
57
+ raise CarrierWave::ProcessingError.new('Unsupported video format.')
58
58
  end
59
59
  end
60
60
 
61
- def transcoder_options(opts)
62
- if opts[:preserve_aspect_ratio]
63
- { preserve_aspect_ratio: opts[:preserve_aspect_ratio] }
61
+ def transcoder_options(preserve_aspect_ratio)
62
+ if preserve_aspect_ratio
63
+ { preserve_aspect_ratio: preserve_aspect_ratio }
64
64
  else
65
65
  { preserve_aspect_ratio: :height }
66
66
  end
@@ -1,3 +1,3 @@
1
1
  module CarrierwaveStreamioFfmpeg
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave_streamio_ffmpeg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ssooraj
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave