如果我尝试在终端上执行ffmpeg命令,那么工作正常但是如果我在我的xcode项目中使用ffmpeg二进制文件并通过NSTask运行ffmpeg命令,那么我会收到错误。
代码:
NSString *str = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ffmpeg-new"];
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:str];
NSArray *array = [NSArray arrayWithObjects:
@"-f",@"avfoundation",
@"-framerate",@"30",
@"-i",@"0:0",
@"-vcodec",@"h264",
@"-acodec",@"aac",
@"-ab",@"64000",
@"-ar",@"48000",
@"-ac",@"2",
@"-f",@"flv",@"rtmp://url",nil];
[task setArguments:array];
[task launch];
[task waitUntilExit];
错误:未知输入格式:avfoundation