Log in

View Full Version : Batching help


Razorblade2000
1st November 2003, 23:23
My Problem...
The files I captured and now want to recompress have names with space in between (e.g. "Family Guy - Season 3 - ep 1_capture")

I made this script but I've got a problem:

#!/bin/bash
cd '/windows/G/tlinux/Family Guy Season 3'
ls -1 *.avi > file.list
while read -r FILENAME
do mencoder -of avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400:keyint=250:mbd=2:vmax_b_frames=2:umv:preme=2:vpass=1 -oac mp3lame -lameopts abr:br=64 -vf pp=hb/vb/dr/al/tn,scale=352:288,denoise3d=9:9:9 -ssf lgb=0.7 -ssf cgb=0.7 -ssf ls=0.9 -ssf cs=0.9 $FILENAME -o New-${FILENAME} && mencoder -of avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400:keyint=250:mbd=2:vmax_b_frames=2:umv:preme=2:vpass=2 -oac mp3lame -lameopts abr:br=64 -vf pp=hb/vb/dr/al/tn,scale=352:288,denoise3d=9:9:9 -ssf lgb=0.7 -ssf cgb=0.7 -ssf ls=0.9 -ssf cs=0.9 $FILENAME -o New-${FILENAME}
done < ./file.list


--> Every time he gives me a "File not found: "Family"


Hmmmm.... at least he doesn't do
File not found: 'Family'
File not found: 'Guy'
no more
Only File not found: 'Family' now

Any solution *g* ?

omol
2nd November 2003, 00:27
Originally posted by Razorblade2000


I made this script but I've got a problem:



--> Every time he gives me a "File not found: "Family"


Hmmmm.... at least he doesn't do
File not found: 'Family'
File not found: 'Guy'
no more
Only File not found: 'Family' now

Any solution *g* ?

Did you try to quote your file path in the script with double quote instead of single quote?

And also, the var FILENAME is not double quoted. The shell will get confused when the var is expanded in the script if the files' names have spaces.

regards,
omol

Razorblade2000
2nd November 2003, 01:17
THX!

#!/bin/bash
cd '/windows/G/torrentlinux/Family Guy Season 3 - DVD Rips'
ls -1 *.avi > file.list
while read -r "FILENAME"
do mencoder -of avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400:keyint=250:mbd=2:vmax_b_frames=2:umv:preme=2:vpass=1 -oac mp3lame -lameopts abr:br=64 -vf pp=hb/vb/dr/al/tn,scale=352:288,denoise3d=9:9:9 -ssf lgb=0.7 -ssf cgb=0.7 -ssf ls=0.9 -ssf cs=0.9 "$FILENAME" -o "New-${FILENAME}" && mencoder -of avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400:keyint=250:mbd=2:vmax_b_frames=2:umv:preme=2:vpass=2 -oac mp3lame -lameopts abr:br=64 -vf pp=hb/vb/dr/al/tn,scale=352:288,denoise3d=9:9:9 -ssf lgb=0.7 -ssf cgb=0.7 -ssf ls=0.9 -ssf cs=0.9 "$FILENAME" -o "New-${FILENAME}"
done < ./file.list

works fine :-D

omol
2nd November 2003, 22:21
Originally posted by Razorblade2000
works fine :-D

Glad to hear that. A nice little trick to debug a bash script without resorting to bash debugger (http://bashdb.sourceforge.net/) is to run the bash script with 'sh -x _the_script_'.

regards,
omol