Sorry, this is a stupid question, but I just cannot seem to get it to
work right. I'm trying to have the unix command line tool Mencoder work
from my cocoa application. I am using the TaskWrapper.m from Moriarity.
This was my original attempt, which didn't work :
mencoderTask=[[TaskWrapper alloc] initWithController:self
arguments:[NSArray arrayWithObjects:mencoderPath,@"-vf
scale=320:240",[infile stringValue], @"-o",[outfile stringValue],@"-of
avi",@"-ovc lavc",@"-oac lavc",@"-lavcopts
vcodec=mpeg4:vbitrate=230:acodec=mp3:abitrate=64",@"-alang en",nil]];
The result was a complaint that said:
Option vf scale=320:240: unknown postfix scale=320:240
So i just tried to make it simple,
changing it to this:
mencoderTask=[[TaskWrapper alloc] initWithController:self
arguments:[NSArray arrayWithObjects:mencoderPath,@"-vf
scale=320:240",nil]];
Again, I get the same error code.
But if I try this in Terminal,
mencoder -vf scale=320:240
It works, and I just get a complaint that I did not enter a file name.
This one:
mencoderTask=[[TaskWrapper alloc] initWithController:self
arguments:[NSArray arrayWithObjects:mencoderPath,@"-ovc lavc",nil]];
also does not work, and the error result is:
-ovc lavc is not an MEncoder option
But it is accepted in Terminal if I say:
mencoder -ovc lavc
So, something I'm doing wrong, but I can't figure it out. I also tried
backslashes in front of the spaces, but that didn't help.
Thanks for any tips
Michael Ash - 30 Sep 2007 14:11 GMT
> Sorry, this is a stupid question, but I just cannot seem to get it to
> work right. I'm trying to have the unix command line tool Mencoder work
[quoted text clipped - 7 lines]
> avi",@"-ovc lavc",@"-oac lavc",@"-lavcopts
> vcodec=mpeg4:vbitrate=230:acodec=mp3:abitrate=64",@"-alang en",nil]];
Read this:
http://www.cocoadev.com/index.pl?NSTaskArguments
The short version is that there is no shell so you need to split up your
arguments more completely. For the long version, read that page. This idea
of where the argument boundaries are is essential for UNIX programming so
hopefully that page will give you some valuable information, not just for
this problem, but for your general experience.

Signature
Michael Ash
Rogue Amoeba Software
none@non.com - 30 Sep 2007 16:10 GMT
> Read this:
>
[quoted text clipped - 5 lines]
> hopefully that page will give you some valuable information, not just for
> this problem, but for your general experience.
Thank you!!