• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTask argument list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask argument list


  • Subject: Re: NSTask argument list
  • From: Sandor Szatmari <email@hidden>
  • Date: Sun, 26 Jun 2016 02:49:44 -0400

Graham,

> On Jun 25, 2016, at 23:37, Graham Cox <email@hidden> 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]];

I believe you would pass the args to NSTask as follows.

self.ffMPEGTask = [NSTask launchedTaskWithLaunchPath:execPath arguments:@[@"-i",  [url absoluteString], @"-c", [self.outputFileURL absoluteString]]];

Type this in mail so it may not be exactly correct, but you get the idea.  Each token in your argument list is put in the argument array individually.

Sandor
>
>
> 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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >NSTask argument list (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSTask argument list
  • Next by Date: Re: NSTask argument list
  • Previous by thread: Re: NSTask argument list
  • Next by thread: Re: exposing only what you want - headers and Swift?
  • Index(es):
    • Date
    • Thread