Don't glom the arguments together.  Pass each as a separate array
element: "-i", the URL string, "-c", "copy", the output string.
 
And you don't need to quote the arguments, just pass them as is.
 
I hope that makes sense -- I'd make it more code-like if I were at my
desk rather than on my phone.
 
--Andy
 
 
On Sat, Jun 25, 2016, at 11:37 PM, Graham Cox wrote:
> HI all,
>
> I am using NSTask to wrap ffmpeg, the video conversion utility.
>
> I am able to invoke ffmpeg alright, but it’s unclear how the argument
> list should be passed through NSTask. I tried making my various
> arguments into one big string, but ffmeg doesn’t parse it, instead
> writing an error.
>
> Here’s my code:
>
>       NSString* execPath = [[[self class] ffMPEGURL] path];
>
>       NSString* argString = [NSString stringWithFormat:@"-i \"%@\" -c
>       copy %@", [url absoluteString], [self.outputFileURL
>       absoluteString]];
>
>       self.ffMPEGTask = [NSTask launchedTaskWithLaunchPath:execPath
>       arguments:@[argString]];
>
>
> What the argument string should look like is:
>
> -i <source url> -c copy <dest file>
>
>
> ffmpeg responds:
>
> Unrecognized option 'i "http://<the stream url>" -c copy
> file:///<destination file>'.
> Error splitting the argument list: Option not found
>
>
> Obviously I need to pass the arguments differently, but it’s not clear
> what I need to do.
>
> —Graham
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
>
> This email sent to ag...@mac.com
 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to