问题
I have created video using AVFoundation and now I want to edit it via GPUImage framework.
I have set all the setting as per mention here. After seeing his example of "SimpleVideoFileFilter" I have just copied his code and replace my Assets URL for Video. Here is the code.
movieFile = [[GPUImageMovie alloc] initWithURL:player.contentURL];
pixellateFilter = [[GPUImagePixellateFilter alloc] init];
[movieFile addTarget:pixellateFilter];
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)];
[pixellateFilter addTarget:movieWriter];
movieWriter.shouldPassthroughAudio = YES;
movieFile.audioEncodingTarget = movieWriter;
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
[movieWriter startRecording];
[movieFile startProcessing];
NSLog(@"precess started");
[movieWriter setCompletionBlock:^{
[pixellateFilter removeTarget:movieWriter];
[movieWriter finishRecording];
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"completed");
});
}];
But I'm getting following error.
Please help me to solve this issue.
回答1:
By reading this I knew that this error occur when video has no audio.
Same issue I have. I have no Audio my asset(Video). So facing this error.
To solve this error I just replaced from
movieFile.audioEncodingTarget = movieWriter;
to
movieFile.audioEncodingTarget = nil;
and code works fine.
回答2:
Not sure if this is the correct answer, but I hope it leads in the right direction.
status
value of 36055 is 0x8CD7 - Missing Attachment.
Excerpt from Apple Discussion Forum - GL Framebuffer Completeness & Blitting Issues
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
According to forum,
It turned out you have to call:
glDrawBuffer(GL_NONE)
glReadBuffer(GL_NONE)on BOTH the source and destination buffers. i.e Both buffers have to be read and draw complete.
This was why I got a seemingly flipped status on the buffers when I checked them.
Cheers.
YJ
来源:https://stackoverflow.com/questions/29917481/unable-to-edit-video-using-gpuimage