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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04cd0f71447efa4f82c579e97d7114ff51cc3abe
|
4
|
+
data.tar.gz: 6d748b21df60d3df5b21f51e9c57a4b790cce74e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d0cd0fb44e8d1ee1b60f3b8b80dab711b9d0d711032b3c80e244c844475d7186509da945099f70a94b6914e7aa752da5916664949918b0c2725a2e91e7d087a
|
7
|
+
data.tar.gz: 1c3bab406e282a29a656bb11e1b0f0c00d2113a5516b60b5bafc2e34a671802b19955d397ecaba8ba1bb56af41ccd722f5d8d373acb6b48819e210122e71da25
|
data/README.md
CHANGED
@@ -3,21 +3,22 @@ require 'carrierwave_streamio_ffmpeg/options'
|
|
3
3
|
|
4
4
|
module CarrierwaveStreamioFfmpeg
|
5
5
|
|
6
|
-
def encode(
|
7
|
-
process encode: [
|
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(
|
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(
|
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
|
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(
|
57
|
+
raise CarrierWave::ProcessingError.new('Unsupported video format.')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def transcoder_options(
|
62
|
-
if
|
63
|
-
{ 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
|
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
|
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
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|