module MultimediaParadise::RemoveAudio

Public Class Methods

[](i) click to toggle source
#

MultimediaParadise::RemoveAudio[]

#
# File lib/multimedia_paradise/audio/remove_audio.rb, line 72
def self.[](i)
  remove_audio_from(i)
end
remove_audio_from(this_file) { || ... } click to toggle source
#

RemoveAudio.remove_audio_from

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

We depend on ffmpeg for this task.

#
# File lib/multimedia_paradise/audio/remove_audio.rb, line 39
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

Public Instance Methods

remove_audio_from(this_file) click to toggle source
#

remove_audio_from

Use this method to remove audio from a given file.

Usage:

remove_audio_from('/Depot/jjjj/264_PlanetOfTheApes.avi')
#
# File lib/multimedia_paradise/audio/remove_audio.rb, line 28
def remove_audio_from(this_file)
  RemoveAudio.remove_audio_from(this_file)
end