GPU图像过滤器禁用iOS的音频 [英] GPU Image Filter disables audio in iOS

查看:249
本文介绍了GPU图像过滤器禁用iOS的音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了使用GPUImage框架视频文件服务器和应用了所有过滤器,但声音被禁用,如果我们发挥视频滤镜。但是,如果我在mpmovieplayer音频播放同一部电影的网址与视频一起播放。下面是我的code:

I have implemented Video filers using GPUImage framework and all the filters are applied, but audio is disabled if we play video with filters. But if i play the same movie url in mpmovieplayer audio is playing along with video. Below is my code:

movieFile = [[GPUImageMovie alloc] initWithURL:self.videoURL];
movieFile.runBenchmark = YES;
movieFile.playAtActualSpeed = YES;

[movieFile addTarget:filter];
[filter setInputRotation:kGPUImageRotateRight atIndex:0];

GPUImageView *view = [[GPUImageView alloc] init];
view.tag = 529;
view.frame = CGRectMake(0, 80, 768, 820);
[filter addTarget:view];
[self.view addSubview:view];

NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]);
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];

movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480.0, 640.0)];
movieWriter.shouldPassthroughAudio = YES;
movieFile.audioEncodingTarget = movieWriter;
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
[filter addTarget:movieWriter];

任何帮助解决这一问题是AP preciated并在此先感谢。

Any help to solve this problem is appreciated and thanks in advance.

推荐答案

目前GPUImage没有办法显示到屏幕上时,从电影播放音频。只有视频帧一GPUImageView内显示

GPUImage currently has no way to play audio from a movie when displaying to the screen. Only the video frames are displayed within a GPUImageView.

您也可以自己添加此功能,如果你需要它。我会很乐意接受与一个拉请求。

You can add this functionality yourself, if you need it. I'd gladly accept a pull request with that.

这篇关于GPU图像过滤器禁用iOS的音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆