0

i've parsed a video web and got the flv files for the video, but the files are seperated, so i must join them together, i know if i use ffmpeg, it should be easy just like ffmpeg -f concat -i mylist.txt -c copy output.flv ,but as i'm writing a mac software, i must write it in objective-c.i could't found any document (or sdk) to read so it's hard for me to begin.

so ,how to join them in objective-c code? do i need to pull the ffmpeg project down to my project?if it is necessary, what is the next step?

abligh
  • 24,573
  • 4
  • 47
  • 84
yudun1989
  • 996
  • 9
  • 23
  • [you could always use a C++ wrapper, and then you can use your C++ library and code.](http://philjordan.eu/article/strategies-for-using-c++-in-objective-c-projects) – Mike Feb 18 '14 at 15:45
  • you could use [NSTask](http://stackoverflow.com/questions/412562/execute-a-terminal-command-from-a-cocoa-app) – vikingosegundo Feb 18 '14 at 15:46
  • @Mike i will have a try on mixing them together, thanx。 – yudun1989 Feb 19 '14 at 02:20

1 Answers1

1

This is hardly a comprehensive answer, but should get you started:

NSTask *task = [[NSTask alloc] init];

[task setLaunchPath:@"<whatever your path to ffmpeg is>"];
// I'm taking your word for the arguments...
[task setArguments:@[@"-f", @"concat", @"-i", @"mylist.txt", @"-c", @"copy", @"output.flv"]];

[task launch];

You may want to go further by setting up a pipe and file handle so that you can get stdout or stderr.

And yes, you'll need to include ffmpeg in your project.

Extra Savoir-Faire
  • 6,026
  • 4
  • 29
  • 47
  • if i've include `ffmpeg` into my project, what's the path to my ffmpeg? [[NSBundle mainBundle] bundlePath]? – yudun1989 Feb 19 '14 at 02:12
  • 1
    Put ffmpeg where you keep your source files. From the 'Editor' menu in Xcode, add a Copy Files build phase, then add ffmpg there, specifying that it goes in Executables. Use `[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"ffmpeg"]` to get the path. – Extra Savoir-Faire Feb 19 '14 at 05:11