Register
It is currently Sat Apr 19, 2014 11:43 pm

can't get name right


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Thu Sep 01, 2011 7:54 am   

Joined: Thu May 26, 2011 7:46 pm
Posts: 7
This is a video converter function that i use, trying to get it work on targeted directory instead of separate files.

I cant get the following function to name the output files right, all i get is a file name .xbox.avi
Code:
xvidenc() {
    for f; do
        mencoder $f/* \
                 -ovc xvid \
                 -oac mp3lame \
                 -xvidencopts bitrate=1100 \
                 -lameopts abr:br=131 \
                 -o "${f%.*}.xbox.avi"
    done
}


Top
 Profile  
 PostPosted: Fri Sep 02, 2011 4:02 am   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
'for f; do' is not valid syntax. The correct syntax would be:
for <variable> in <value1> [<value2> [...]]; do


Top
 Profile  
 PostPosted: Fri Sep 02, 2011 4:09 am   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
Patsie wrote:
'for f; do' is not valid syntax. The correct syntax would be:
for <variable> in <value1> [<value2> [...]]; do

It is valid syntax. Form man bash:
Quote:
If the in word is omitted, the for command executes list once for each positional parameter that is set


Top
 Profile  
 PostPosted: Fri Sep 02, 2011 12:13 pm   
User avatar

Joined: Sat Jul 02, 2011 10:43 am
Posts: 23
Location: Devon,UK
If I understand you right you want to feed all the video files in a folder to mencoder and re-encode them for xbox and add the ".xbox.avi" suffix but keep the filename, if so try this
Code:
xvidenc1() {
    find "$1" -iname "*.mp4" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.avi" -o -iname "*.flv" -mindepth 1 | while read
       do
          echo "From file=$REPLY To file=${REPLY%.*}.xbox.avi"
   done
}

xvidenc ./testfolder


output from the folder "./testfolder" containg the files:"file1.mp4" "file2.flv" "new file.mpg"
Code:
From file=./testfolder/new file.mpg To file=./testfolder/new file.xbox.avi
From file=./testfolder/file1.mp4 To file=./testfolder/file1.xbox.avi
From file=./testfolder/file2.flv To file=./testfolder/file2.xbox.avi

Obviously you need to replace the echo's with your mencoder code and add xtra file suffix's


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP