PDA

View Full Version : system command


magnum1116
08-03-2007, 03:42 AM
good day to all mel gurus out there, i am writing a mel script that will convert image sequences into mov using mencoder in linux, everything is fine but the only problem is: the system command is not doing anything in my mel script, here is my code:

global proc vher_MMCHplayblast()
{
$win = "vher_MMCHplayblastUI";
if ( `window -exists $win` )
deleteUI $win;
vher_MMCHplayblastUI $win;
showWindow $win;
}

global proc vher_MMCHplayblastUI ( string $win )
{

string $vherCurrentFile = `file -q -sn`;
string $vherWorkDir = `internalVar -uwd`;
string $vherSceneDir = `match "^.*[/\\]" $vherCurrentFile`;
string $vherSceneName = `match "[^/\\]*$" $vherCurrentFile`;
string $vherAviName = `match "^[^\.]*" $vherSceneName `;
string $vherAviDir = `substitute "/scenes" $vherSceneDir "/images"`;
string $vherGetAudio[] = `ls -type audio`;
string $vherAudio = `getAttr ($vherGetAudio[0] + ".filename")`;


window -t "Vher MMCH Playblast to AVI" -w 350 -h 400 $win;
scrollLayout -hst 16 -vst 16 -childResizable true;
columnLayout -adj 1;

frameLayout -label "Path"
-labelAlign "center"
-borderStyle "etchedIn";

columnLayout -adj 1;


textFieldGrp -l "Output Name"
-w 300 -text $vherAviName
-adj 2 -enable true
-ed true -cw1 100 -cw2 100 250
-cl2 left center vherImgName;
separator -w 350 -style "in";

textFieldGrp -l "Wav Dir"
-w 300 -text $vherAudio
-adj 2 -enable true
-ed false -cw1 100 -cw2 100 250
-cl2 left center vherWavFileDir;
separator -w 350 -style "in";

textFieldGrp -l "AVI Dir"
-w 300 -text $vherAviDir
-adj 2 -enable true
-ed false -cw1 100 -cw2 100 250
-cl2 left center vherImgFileDir;

intSliderGrp -l "Playblast Size"
-field true
-minValue 10 -maxValue 100
-fieldMinValue 10 -fieldMaxValue 100
-value 50 vherBlastSize;
separator -w 350 -style "in";


setParent..;

setParent..;



frameLayout -label "RenderOptions"
-labelAlign "center"
-borderStyle "etchedIn";

columnLayout -adj 1;
rowColumnLayout -nc 4;
text "Start Frame";
intField -min 0 -max 10000 -v 1 -s 1 -ed true vherStartFrame;
text "EndFrame";
intField -min 0 -max 10000 -v 1 -s 1 -ed true vherEndFrame;
setParent..;

columnLayout -adj 1;

separator -w 350 -style "in";
setParent..;

columnLayout -adj 1;
separator -w 350 -style "in";
setParent..;

columnLayout -adj 1;
text "Be sure to check";
text "all options before creating";
text "the AVI file.";
button -l "Create Image File" -c "vherCreateImgFile;";
button -l "Convert Images to AVI" -c "vherConvertToAvi;";
setParent..;

setParent;




}

global proc vherCreateImgFile ()
{


int $vherBatchStartFrame = `intField -q -v vherStartFrame`;
int $vherBatchEndFrame = `intField -q -v vherEndFrame`;
int $vherBatchSize = `intSliderGrp -q -v vherBlastSize`;

string $vherBatchImgName = `textFieldGrp -q -tx vherImgName`;
string $vherAudioStream = `textFieldGrp -q -tx vherWavFileDir`;
string $vherBlastImgDir = `textFieldGrp -q -tx vherImgFileDir`;

playblast -fmt image -st $vherBatchStartFrame -et $vherBatchEndFrame -f $vherBatchImgName -fo -wh 960 540 -p $vherBatchSize;



}

global proc vherConvertToAvi ()
{

string $vherBatchImgName = `textFieldGrp -q -tx vherImgName`;
//string $vherStreamName = `textFieldGrp -q -tx vherImgName`;

string $vherAudioStream = `textFieldGrp -q -tx vherWavFileDir`;
string $vherBlastImgDir = `textFieldGrp -q -tx vherImgFileDir`;
string $vherBlastImages = $vherBlastImgDir + "*jpg";

string $vherStreamOut = $vherBlastImgDir + $vherBatchImgName + ".mov";

system "mencoder mf://$vherBlastImages -mf w=960: h=540: fps=24: -ovc lavc lavcopts vcodec=mpeg4:mbd=2:trell -sound $vherAudioStream -o $vherStreamOut";

}

the thing is if i execute the system command in the script editor, it is doing fine:
system "mencoder mf:///home/omagno/maya/projects/MMCH_212P_211_199/images/*jpg -mf w=960: h=540: fps=24: -ovc lavc lavcopts vcodec=mpeg4:mbd=2:trell -sound /ToonCity3D/3dProd/projects/MMCH/References/212P_211_MMCH/20070621-soundtrack/199.wav -o /home/omagno/maya/projects/MMCH_212P_211_199/images/212P_211_199_v001_m2.mov"

is there a problem with the code:
global proc vherConvertToAvi ()
{

string $vherBatchImgName = `textFieldGrp -q -tx vherImgName`;
//string $vherStreamName = `textFieldGrp -q -tx vherImgName`;

string $vherAudioStream = `textFieldGrp -q -tx vherWavFileDir`;
string $vherBlastImgDir = `textFieldGrp -q -tx vherImgFileDir`;
string $vherBlastImages = $vherBlastImgDir + "*jpg";

string $vherStreamOut = $vherBlastImgDir + $vherBatchImgName + ".mov";

system "mencoder mf://$vherBlastImages -mf w=960: h=540: fps=24: -ovc lavc lavcopts vcodec=mpeg4:mbd=2:trell -sound $vherAudioStream -o $vherStreamOut";
}

??????
any help is highly appreciated, thanks a lot.

NolanSW
08-03-2007, 04:34 PM
May try:

system ("mencoder mf://" + $vherBlastImages + " -mf w=960: h=540: fps=24: -ovc lavc lavcopts vcodec=mpeg4:mbd=2:trell -sound " + $vherAudioStream + " -o " + $vherStreamOut);

The way you have it before is that you are passing in "$vherBlastImages" instead of the data that resides in that variable. So you have to concatenate the strings together. I don't know for sure if my code will work for you but you should get the idea.

-Sean

magnum1116
08-07-2007, 04:43 AM
May try:

system ("mencoder mf://" + $vherBlastImages + " -mf w=960: h=540: fps=24: -ovc lavc lavcopts vcodec=mpeg4:mbd=2:trell -sound " + $vherAudioStream + " -o " + $vherStreamOut);

The way you have it before is that you are passing in "$vherBlastImages" instead of the data that resides in that variable. So you have to concatenate the strings together. I don't know for sure if my code will work for you but you should get the idea.

-Sean

thank you very much sir NolanSW, it works, :bounce::applause::thumbsup:

i owe you one!!!

CGTalk Moderation
08-07-2007, 04:43 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.