I’m trying to do a mass encode of a large directory of media files but
I’m not having much luck. I tried to use bash but it doesn’t like
filenames with spaces so now I’m trying to do it with ruby but using the
exec command it executes the first line then finishes. Here’s what I’ve
done in the IRB.
It would be sweetness on a stick if it worked but unfortunately it stops
after the first one. Can anyone tell me what I’m doing wrong and more
importantly what I need to do to make this work?
If I replace exec with puts it lists the commands fine. My problem is
that when I use exec it runs the first command fine then exits ignoring
all the other files. For example if I have a directory that has the
files:
At Wed, 18 Jan 2006 13:09:23 +0900,
Jason C. wrote in [ruby-talk:176073]:
I’m trying to do a mass encode of a large directory of media files but
I’m not having much luck. I tried to use bash but it doesn’t like
filenames with spaces so now I’m trying to do it with ruby but using the
exec command it executes the first line then finishes. Here’s what I’ve
done in the IRB.
exec replaces current process with invoked command, use system
instead.
And also bash should work if you quote names properly:
opts="-vf scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=150 -oac mp3lame -lameopts vbr=3:br=64"
for x in *.avi; do
mencoder “$x” $opts -o “Done/$x”
At Wed, 18 Jan 2006 13:09:23 +0900,
Jason C. wrote in [ruby-talk:176073]:
I’m trying to do a mass encode of a large directory of media files but
I’m not having much luck. I tried to use bash but it doesn’t like
filenames with spaces so now I’m trying to do it with ruby but using the
exec command it executes the first line then finishes. Here’s what I’ve
done in the IRB.
exec replaces current process with invoked command, use system
instead.
And also bash should work if you quote names properly:
opts="-vf scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=150
-oac mp3lame -lameopts vbr=3:br=64"
for x in *.avi; do
mencoder “$x” $opts -o “Done “$x””
done
Sweetness! Thanks! Actually now it seems that all my created files are
in the same directory prefaced by ‘\Done’ instead of going in the Done
directory. Go figure. Oh well. At least I can encode en masse! Good
thing too. I’ve got a 50+ files to re-encode (a series) for my
pocketpc. When you can stuff 15 hours of video on a 1gb sd card that’s
a good thing™.
My bash script was similar but I didn’t have the quotes.
Thanks again!
J
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.