Module: MultimediaParadise::Audio::RemoveAudio

Defined in:
lib/multimedia_paradise/audio/remove_audio.rb

Overview

MultimediaParadise::Audio::RemoveAudio[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](i) ⇒ Object

#

MultimediaParadise::RemoveAudio[]

#


77
78
79
# File 'lib/multimedia_paradise/audio/remove_audio.rb', line 77

def self.[](i)
  remove_audio_from(i)
end

.remove_audio_from(this_file, &block) ⇒ Object

#

RemoveAudio.remove_audio_from

Use this method to remove the audio from a multimedia file.

We depend on ffmpeg for this task.

#


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/multimedia_paradise/audio/remove_audio.rb', line 44

def self.remove_audio_from(this_file, &block)
  # ======================================================================= #
  # Handle arrays first.
  # ======================================================================= #
  this_file = this_file.first if this_file.is_a? Array
  # Next determine the output filename.
  output_file_name = (Dir.pwd+'/output_'+File.basename(this_file)).squeeze '/'
  _ = "ffmpeg -i #{this_file} -an -vcodec copy ".dup
  # ======================================================================= #
  # Next, any block-argument given can still modify the commandline
  # arguments used here.
  # ======================================================================= #
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :always_overwrite_existing_files
    #
    # This will simply overwrite any existing file.
    # ===================================================================== #
    when :always_overwrite_existing_files
      _ << "-y "
    end
  end
  _ << output_file_name
  puts _
  system _
  return output_file_name
end

Instance Method Details

#remove_audio_from(this_file) ⇒ Object

#

remove_audio_from

Use this method to remove audio from a given file.

Usage:

remove_audio_from('/Depot/jjjj/264_PlanetOfTheApes.avi')
#


33
34
35
# File 'lib/multimedia_paradise/audio/remove_audio.rb', line 33

def remove_audio_from(this_file)
  RemoveAudio.remove_audio_from(this_file)
end