rff 0.2 → 0.2.1

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
  SHA1:
3
- metadata.gz: 246923c57cdd775302fc981bf79ed642effccf5f
4
- data.tar.gz: a77efae571f4648bee009534e10f608d094d65a9
3
+ metadata.gz: d7f531623ad10e04e6d56a0239288a07c29496a0
4
+ data.tar.gz: d1ac919f17abb2c66c8852f3f6ab633112ed08b0
5
5
  SHA512:
6
- metadata.gz: 3ffbd9f2fb140174e8c2e927b7fa4d5dd4ee4bf1529bbb51573be045d22ea2a95fef8e8b966e70c9b4ca2ab9f793ccabaff172cc1fadc026033498094f9d000d
7
- data.tar.gz: 967e748b929e7c7121fa020b48065cf70426ed4944cbb5abd39eafee810ff18e4df3ad9ca59e4a728fc661d0a39d6256189df7a93e057b3e59b462ef19fccd2f
6
+ metadata.gz: 99470bb909ffbd3c8a6bb458bf04dc1d8af395e6824ff59bd54010b10d80bef347fdf63d42afffd028d842ef63761a71c16265579b969a898d536048cde21f52
7
+ data.tar.gz: 1966c047232f8f3940aba4a3533ebfaeb2fc9279d610eebceba3ffa6eb31827b7db7763c257fbdcb4a1a77a64d487e181dbd2e22c27e15ca17be721f208f31a7
@@ -15,9 +15,10 @@ module RFF
15
15
  # * <i>output_path</i> - a path to place the output file in. Defaults to nil, which means that the input' s directory path is used
16
16
  # * <i>custom_args</i> - passes custom arguments to FFmpeg. Defaults to nil, which means no custom arguments are given
17
17
  # * <i>recommended_audio_quality</i> - determines if recommended by FFmpeg community audio quality settings should be used. Defaults to true, which means audio conversion with good, recommended quality. Set to false if you are giving additional arguments that determine this quality.
18
+ # * <i>disable_subtitles_decoding</i> - in some formats subtitle decoding causes problems. This option disables this feature. Defaults to true to bypass problems by default.
18
19
  # All of the arguments are passed on to underlying Processor instances. This method also determines input type, initializes processing percentage and creates needed Processor instances.
19
20
 
20
- def initialize input, output_path=nil, custom_args=nil, recommended_audio_quality=true
21
+ def initialize input, output_path=nil, custom_args=nil, recommended_audio_quality=true, disable_subtitles_decoding=true
21
22
  @input = input
22
23
  @input_type = File.basename(@input).split(".")[1]
23
24
  @output_path = output_path
@@ -29,7 +30,7 @@ module RFF
29
30
  types.delete(@input_type.to_sym)
30
31
  end
31
32
  types.each do |type|
32
- @processors << RFF::Processor.new(@input, type, @output_path, nil, @custom_args, recommended_audio_quality)
33
+ @processors << RFF::Processor.new(@input, type, @output_path, nil, @custom_args, recommended_audio_quality, disable_subtitles_decoding)
33
34
  end
34
35
  end
35
36
 
@@ -15,9 +15,10 @@ module RFF
15
15
  # * _quality_ - only affects video conversion. Sets the video conversion quality. Defaults to 5000k, which is tested value for good video conversion quality
16
16
  # * <i>custom_args</i> - passes custom arguments to FFmpeg. Defaults to nil, which means no custom arguments are given
17
17
  # * <i>recommended_audio_quality</i> - determines if recommended by FFmpeg community audio quality settings should be used. Defaults to true, which means audio conversion with good, recommended quality. Set to false if you are giving additional arguments that determine this quality.
18
+ # * <i>disable_subtitles_decoding</i> - in some formats subtitle decoding causes problems. This option disables this feature. Defaults to true to bypass problems by default.
18
19
  # This method also validates arguments, determines full output name, generates appropriate FFmpeg command, determines conversion type and initializes status (it is :pending at this point).
19
20
 
20
- def initialize input, output_type, output_path=nil, quality="5000k", custom_args=nil, recommended_audio_quality=true
21
+ def initialize input, output_type, output_path=nil, quality="5000k", custom_args=nil, recommended_audio_quality=true, disable_subtitles_decoding=true
21
22
  if input.nil? || input.empty? || output_type.nil?
22
23
  raise RFF::ArgumentError.new("Input and output type can not be empty nor nil!")
23
24
  end
@@ -31,10 +32,10 @@ module RFF
31
32
  @quality = quality
32
33
  @custom_args = custom_args
33
34
  if [:mp3, :ogg, :wav].include?(@output_type)
34
- @command = "ffmpeg -y -i #{@input} -acodec #{@output_type == :mp3 ? "libmp3lame" : (@output_type == :ogg ? "libvorbis" : "pcm_s16le")}#{recommended_audio_quality ? (@output_type == :mp3 ? " -aq 2" : (@output_type == :ogg ? " -aq 4" : "")) : ""}#{@custom_args.nil? ? "" : " #{@custom_args}"} #{@output_path}/#{@output_name}.#{@output_type.to_s}"
35
+ @command = "ffmpeg -y -i " + '"' + "#{@input}" + '"' + " -acodec #{@output_type == :mp3 ? "libmp3lame" : (@output_type == :ogg ? "libvorbis" : "pcm_s16le")}#{recommended_audio_quality ? (@output_type == :mp3 ? " -aq 2" : (@output_type == :ogg ? " -aq 4" : "")) : ""}#{disable_subtitles_decoding ? " -sn" : ""}#{@custom_args.nil? ? "" : " #{@custom_args}"} " + '"' + "#{@output_path}/#{@output_name}.#{@output_type.to_s}" + '"'
35
36
  @conversion_type = :audio
36
37
  else
37
- @command = "ffmpeg -y -i #{@input} -acodec #{(@output_type == :webm || @output_type == :ogv) ? "libvorbis" : "aac"} -vcodec #{@output_type == :webm ? "libvpx" : (@output_type == :ogv ? "libtheora" : "mpeg4")}#{@output_type == :mp4 ? " -strict -2" : ""}#{(!@quality.nil? && !@quality.empty?) ? " -b:v #{@quality}" : ""}#{recommended_audio_quality ? (@output_type == :webm || @output_type == :ogv ? " -aq 4" : " -b:a 240k") : ""}#{@custom_args.nil? ? "" : " #{@custom_args}"} #{@output_path}/#{@output_name}.#{@output_type.to_s}"
38
+ @command = "ffmpeg -y -i " + '"' + "#{@input}" + '"' + " -acodec #{(@output_type == :webm || @output_type == :ogv) ? "libvorbis" : "aac"} -vcodec #{@output_type == :webm ? "libvpx" : (@output_type == :ogv ? "libtheora" : "mpeg4")}#{@output_type == :mp4 ? " -strict -2" : ""}#{(!@quality.nil? && !@quality.empty?) ? " -b:v #{@quality}" : ""}#{recommended_audio_quality ? (@output_type == :webm || @output_type == :ogv ? " -aq 4" : " -b:a 240k") : ""}#{disable_subtitles_decoding ? " -sn" : ""}#{@custom_args.nil? ? "" : " #{@custom_args}"} " + '"' + "#{@output_path}/#{@output_name}.#{@output_type.to_s}" + '"'
38
39
  @conversion_type = :video
39
40
  end
40
41
  @status = :pending
@@ -12,9 +12,10 @@ module RFF
12
12
  # * _quality_ - only affects video conversion. Sets the video conversion quality. Defaults to 5000k, which is tested value for good video conversion quality
13
13
  # * <i>custom_args</i> - passes custom arguments to FFmpeg. Defaults to nil, which means no custom arguments are given
14
14
  # * <i>recommended_audio_quality</i> - determines if recommended by FFmpeg community audio quality settings should be used. Defaults to true, which means audio conversion with good, recommended quality. Set to false if you are giving additional arguments that determine this quality.
15
+ # * <i>disable_subtitles_decoding</i> - in some formats subtitle decoding causes problems. This option disables this feature. Defaults to true to bypass problems by default.
15
16
  # All of the arguments are passed on to underlying Processor instances. This method also determines input type, initializes processing percentage and creates needed Processor instances.
16
17
 
17
- def initialize input, output_path=nil, quality="5000k", custom_args=nil, recommended_audio_quality=true
18
+ def initialize input, output_path=nil, quality="5000k", custom_args=nil, recommended_audio_quality=true, disable_subtitles_decoding=true
18
19
  @input = input
19
20
  @input_type = File.basename(@input).split(".")[1]
20
21
  @output_path = output_path
@@ -27,7 +28,7 @@ module RFF
27
28
  types.delete(@input_type.to_sym)
28
29
  end
29
30
  types.each do |type|
30
- @processors << RFF::Processor.new(@input, type, @output_path, @quality, @custom_args, recommended_audio_quality)
31
+ @processors << RFF::Processor.new(@input, type, @output_path, @quality, @custom_args, recommended_audio_quality, disable_subtitles_decoding)
31
32
  end
32
33
  end
33
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rff
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phitherek_