Unable to edit video using GPUImage

回眸只為那壹抹淺笑 提交于 2019-12-23 03:07:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!