Group Group Group Group Group Group Group Group Group

NSTask vs. shell script

Upon checking out the NSTask tutorial ( I’m second-guessing myself with regard to the direction I’ve taken with my first MacOS app.

Here’s the issue I’m facing. I need to analyze an audio file with ffprobe, and use some of that information to create arguments that I pass to ffmpeg, both of which are going to be located in the main resource bundle of the app so that the user doesn’t have to download and install it themselves.

While I’m sure there is a way to capture the console output from ffprobe, convert it to a string, parse that string, isolate the portion of it I require, convert it back from a string if necessary, and proceed from there in using it to build the arguments I’m passing to ffmpeg, I’m wondering if it’s more efficient to instead write a shell script that will do that, and then run the shell script with NSTask instead of running ffprobe/ffmpeg directly.

Can a shell script even work with command line programs that are in the main resource bundle? How would I go about doing this?

Hi @ncrusher,
I believe you had a similar question on using stderr and stdout. Assuming that you are still searching for a way to do this. You can invoke a shell command and pass it the file from the resource that you can write to the temp dir where you run the commandline.


Thank you! I ended up going in a different direction with this altogether, so the shell question isn’t really a part of the equation anymore. Thank you for answering, though!