Mrugesh Tank
Mrugesh Tank

Reputation: 3560

Unable to edit video using GPUImage

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.

error in GPUImage

Please help me to solve this issue.

Upvotes: 1

Views: 182

Answers (2)

DeathStroke
DeathStroke

Reputation: 124

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.

Upvotes: 2

Black Frog
Black Frog

Reputation: 11725

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

Upvotes: 1

Related Questions