rff 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/audio_handler.rb +8 -1
- data/lib/video_handler.rb +8 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e0eaf2f8072ba5ce77678f94cacc1b4ab17e3a2
|
4
|
+
data.tar.gz: 81087d4117ea3433eac6b60d9fb3c1052c770603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 895365c54559af93d28fd606f36232e47dca4a3c004534e3720791ef8f5dfedec3b0afc56c22a2dab641bfe9e93ff0fec45d557c8d4151c1871e633ca3e1d2bc
|
7
|
+
data.tar.gz: 1166e59e70ca317d63b228f1c1593ea86580977d4089bf627eb548a270d07815d1cf3c77740bed7add6be59b79a0f73db4cf63ab02ba486c7f3f4598287fc7c6
|
data/lib/audio_handler.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'processor'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
# The main module for _rff_ - a Ruby gem for simple audio and video conversion for HTML5 using FFmpeg
|
4
5
|
# Author:: Phitherek_ <phitherek [at] gmail [dot] com>
|
@@ -6,7 +7,7 @@ require_relative 'processor'
|
|
6
7
|
|
7
8
|
module RFF
|
8
9
|
|
9
|
-
# This class provides an "All audio to HTML5" conversion functionality. It takes every compatible with FFmpeg audio format and converts it to the three HTML5 audio formats - mp3, ogg and wav. If the input is already in one of these formats it is only converted to the two other formats, because it can be used as one of HTML5 sources.
|
10
|
+
# This class provides an "All audio to HTML5" conversion functionality. It takes every compatible with FFmpeg audio format and converts it to the three HTML5 audio formats - mp3, ogg and wav. If the input is already in one of these formats it is only converted to the two other formats and the original file is copied to the output directory, because it can be used as one of HTML5 sources.
|
10
11
|
|
11
12
|
class AudioHandler
|
12
13
|
|
@@ -26,8 +27,14 @@ module RFF
|
|
26
27
|
@processing_percentage = 0
|
27
28
|
@processors = []
|
28
29
|
types = [:mp3, :ogg, :wav]
|
30
|
+
if !@output_path.nil? && !File.exists?(@output_path)
|
31
|
+
FileUtils.mkdir_p(@output_path)
|
32
|
+
end
|
29
33
|
if types.include?(@input_type.to_sym)
|
30
34
|
types.delete(@input_type.to_sym)
|
35
|
+
if !@output_path.nil?
|
36
|
+
FileUtils.cp @input, @output_path
|
37
|
+
end
|
31
38
|
end
|
32
39
|
types.each do |type|
|
33
40
|
@processors << RFF::Processor.new(@input, type, @output_path, nil, @custom_args, recommended_audio_quality, disable_subtitles_decoding)
|
data/lib/video_handler.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require_relative 'processor'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
module RFF
|
4
5
|
|
5
|
-
# This class provides an "All video to HTML5" conversion functionality. It takes every compatible with FFmpeg video format and converts it to the three HTML5 video formats - mp4, ogv and webm. If the input is already in one of these formats it is only converted to the two other formats, because it can be used as one of HTML5 sources.
|
6
|
+
# This class provides an "All video to HTML5" conversion functionality. It takes every compatible with FFmpeg video format and converts it to the three HTML5 video formats - mp4, ogv and webm. If the input is already in one of these formats it is only converted to the two other formats and the original file is copied to the output directory, because it can be used as one of HTML5 sources.
|
6
7
|
|
7
8
|
class VideoHandler
|
8
9
|
|
@@ -24,8 +25,14 @@ module RFF
|
|
24
25
|
@processing_percentage = 0
|
25
26
|
@processors = []
|
26
27
|
types = [:mp4, :ogv, :webm]
|
28
|
+
if !@output_path.nil? && !File.exists?(@output_path)
|
29
|
+
FileUtils.mkdir_p(@output_path)
|
30
|
+
end
|
27
31
|
if types.include?(@input_type.to_sym)
|
28
32
|
types.delete(@input_type.to_sym)
|
33
|
+
if !@output_path.nil?
|
34
|
+
FileUtils.cp @input, @output_path
|
35
|
+
end
|
29
36
|
end
|
30
37
|
types.each do |type|
|
31
38
|
@processors << RFF::Processor.new(@input, type, @output_path, @quality, @custom_args, recommended_audio_quality, disable_subtitles_decoding)
|