dtown22 / gmail.com wrote:
> "C:\Documents and Settings\dt\Desktop\my stuff\songs\wma\ffmpeg.exe" -
> i "C:\Documents and Settings\dt\Desktop\my stuff\songs\Who The
> \Quadrophenia\07-0 - Who The - Love Reign O'er Me.wma" -vn -f wav - |
> "C:\Documents and Settings\dt\Desktop\my stuff\songs\wma\lame.exe" -V
> 6 - "C:\Documents and Settings\dt\Desktop\my stuff\songs\\Who The
> \Quadrophenia\07-0 - Who The - Love Reign O'er Me.mp3"
> 
> It works perfect from the command line, but no matter how i try it
> (with double quotes, single quotes, backticks, etc) it doesnt seem to
> want to work from ruby
> 
> Here is an example of the code I have
> 
>  ffmpeg = '"C:\\Documents and Settings\\dt\\Desktop\\my stuff\\songs\
> \wma\\ffmpeg.exe"'
>   lame = '"C:\\Documents and Settings\\dt\\Desktop\\my stuff\\songs\
> \wma\\lame.exe"'
> 
> newFile = child.sub('wma', 'mp3')
> #cmd = ffmpeg + " -i " + child + " -vn -f wav - | "  + lame + " -V 6 -
> " + newFile
> cmd1 = "#{ffmpeg} -i #{child} -vn -f wav - | #{lame} -V 6 -
> #{newFile}"
> puts cmd1
> system(cmd1)
> 
> NOTE: child points to the same file wma file as above.
> 
> If i copy and paste the output of the puts command above into a
> command window, it works fine...but from ruby, it seems to ignore the
> pipe (|) command. I dont know if this is a windows issue, or if i am
> missing something obvious. Any help is greatly appreciated.

Alright lets approach this from a different perspective. First, the 
reason that lame or ffmpeg arnt working is because its loading them as 
strings into ruby, instead of loading the exe's. There should be a gem 
or lib in ruby that loads exe's into memory but i havnt had the time 
today to fumble around the net for it. Using a gem to convert these 
files would be alot better than loading exes into memory. If you were on 
linux you could do all this with some bash scripting but :( we'll find 
another way.

>cmd1 = "#{ffmpeg} -i #{child} -vn -f wav - | #{lame} -V 6 -
> #{newFile}"

the reason this isnt working is because Ruby doesnt take command line 
arguements like Windows cmd.exe or command.com does. Ruby interprets 
these as minus signs and negative signs. I would imagine running this 
gives you some outrageous errors. If you could post your entire program 
and we'll see if we cant find a gem or lib that will do this.

- Mac
-- 
Posted via http://www.ruby-forum.com/.