Hi all,
Greetings for the Day!!!!
FFMPEG binary downloading and sandboxing in an app is already covered in previous posts.
Now its time to use the binary.
Lets start....
Greetings for the Day!!!!
FFMPEG binary downloading and sandboxing in an app is already covered in previous posts.
Now its time to use the binary.
Lets start....
- (void)startTerminalTask
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
NSString *str = [[NSBundle mainBundle] pathForResource:@"ffmpeg" ofType:@""];
terminalTaskForVideoCapture = [[NSTask alloc] init];
terminalTaskForScreenCapture = [[NSTask alloc] init];
[terminalTaskForVideoCapture setLaunchPath:str];
[terminalTaskForScreenCapture setLaunchPath:str];
NSArray *argumentsForVideoCapture = [NSArray arrayWithObjects:
@"-f",@"avfoundation",
@"-framerate",@"30",
@"-i",@"0:0",
@"-vcodec",@"h264",
@"-acodec",@"aac",
@"-ab",@"64000",
@"-ar",@"48000",
@"-ac",@"2",
@"-f",@"flv",
self.streamingUrl,nil];
NSLog(@"argumentsForVideoCapture : %@",argumentsForVideoCapture);
[terminalTaskForVideoCapture setArguments:argumentsForVideoCapture];
[terminalTaskForVideoCapture launch];
NSArray *argumentsForScreenCapture = [NSArray arrayWithObjects:
@"-f",@"avfoundation",
@"-framerate",@"30",
@"-i",@"1",
@"-vcodec",@"libx264",
@"-acodec",@"aac",
@"-ab",@"64000",
@"-ar",@"48000",
@"-ac",@"2",
@"-f",@"flv",
self.screenCaptureUrl,nil];
NSLog(@"argumentsForScreenCapture : %@",argumentsForScreenCapture);
[terminalTaskForScreenCapture setArguments:argumentsForScreenCapture];
[terminalTaskForScreenCapture launch];
});
}
- (void)stopTerminalTask
{
[terminalTaskForVideoCapture terminate];
[terminalTaskForScreenCapture terminate];
}
No comments:
Post a Comment