linuxkurs/beispiele/16/file-to-mp3-192k.rb

21 lines
419 B
Ruby
Raw Normal View History

2019-03-04 13:24:35 +01:00
#!/usr/bin/env ruby
def convert(file,filebase)
#`ffmpeg -i '#{file}' -ab 192k '#{filebase}'.mp3`
`lame -q 0 -b 192 '#{file}' '#{filebase}'.mp3`
end
dir = Dir.new(".")
while file = dir.read do
reg = /(m4a|ogg|wav)/i
puts reg
if file.match(reg)
filebase = File.basename(file, "." + file.match(reg).to_s)
convert(file, filebase)
else
puts "Keine passende Datei gefunden: m4a, ogg, wav. "
end
end