GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

The current version, the video processing error at the beginning .

Open jasudev opened this issue 11 years ago • 22 comments

In the current version, an error will occur. In August, but the downloaded version did not have this problem. What problem?

The link below is a problem SimpleVideoFileFilter project file. http://www.ifacies.com/test/SimpleVideoFileFilter.zip

Error message : 2013-10-24 03:46:44.264 SimpleVideoFileFilter[8738:60b] Application windows are expected to have a root view controller at the end of application launch 2013-10-24 03:46:44.426 SimpleVideoFileFilter[8738:1603] *** Assertion failure in -[GPUImageMovieWriter createDataFBO], /Users/jasu/Dropbox/iPhoneDevelop/DEVELOP_PROJECT/GlassMov_PROJECT/framework/GPUImage-master22/framework/Source/iOS/GPUImageMovieWriter.m:548 2013-10-24 03:46:44.446 SimpleVideoFileFilter[8738:1603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Incomplete filter FBO: 36055' *** First throw call stack: (0x30fdde8b 0x3b2d86c7 0x30fddd5d 0x3198623f 0x31aff 0x31dd7 0x31ec9 0x3236d 0xfcd7 0x11ebf 0x2725b 0x26a13 0x26761 0x3b7c18fb 0x1ca8b 0x265e3 0x25aaf 0x3103b 0x2fe26a1f 0x3b7bd103 0x3b7c1e77 0x3b7bef9b 0x3b7c2751 0x3b7c29d1 0x3b8ecdff 0x3b8eccc4) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

jasudev avatar Oct 23 '13 16:10 jasudev

I'm getting this too, in Xcode 5.0.1 and iOS 7. It seems to be crashing in GPUImageMovieWriter.m:548

NSAssert(status == GL_FRAMEBUFFER_COMPLETE, @"Incomplete filter FBO: %d", status);

dimitribouniol avatar Oct 23 '13 23:10 dimitribouniol

WRT: Application windows are expected to have a root view controller at the end of application launch

In AppDelegate.m

//[self.window addSubview:rootViewController.view]; [self.window setRootViewController:rootViewController];

HTH, -D

DuncanRowland avatar Nov 04 '13 14:11 DuncanRowland

Any update on this.. i am also facing the same with xcode5 and ios7. i am running the app on actual device and get this error at tis line : NSAssert(status == GL_FRAMEBUFFER_COMPLETE, @"Incomplete filter FBO: %d", status); *** Assertion failure in -[GPUImageMovieWriter createDataFBO], /Volumes/DEVELOP_PROJECT/Libs/GPUImage-master/framework/Source/iOS/GPUImageMovieWriter.m:548 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Incomplete filter FBO: 36055'

Please help me solve the issue or inform me of any workaround. Will really appreciate it.

Azeem

AzeemKhan123 avatar Nov 12 '13 08:11 AzeemKhan123

As per my investigation issue occurs when thr is no audio or audio channel in the video.

AzeemKhan123 avatar Nov 12 '13 09:11 AzeemKhan123

That's probably it - I only experience crashes on videos without sound.

andreaslindahl avatar Nov 12 '13 09:11 andreaslindahl

Crash on videos without sound! fixed:

AVAsset *anAsset = [AVAsset assetWithURL:_dictInfo[UIImagePickerControllerMediaURL]]; AVAssetTrack *assetTrack = [[anAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; _movieFile = [[GPUImageMovie alloc] initWithAsset:anAsset]; _movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:_URLInputVideoFile size:assetTrack.naturalSize];

        if ([[anAsset tracksWithMediaType:AVMediaTypeAudio] count] > 0){
            _movieFile.audioEncodingTarget = _movieWriter;
        } else {//no audio
            _movieFile.audioEncodingTarget = nil;
        }

It works for me!

dovtuan avatar Apr 07 '14 04:04 dovtuan

Doesn't work for me, unfortunately. Doing this, I get a crash if the video HAS audio as well.

The audioEncodingTarget property of my GPUImageMovie is already nil, btw.

Has anyone else managed to solve this bug using dovtuan's solution?

andreaslindahl avatar Apr 08 '14 11:04 andreaslindahl

Any update on this? I use Crashlytics and this is one of the most consistent issues that I see. A user mentioned that a crash occurs when using the Cartoon filter but when I test all seems to be fine.

This is what Crashlytics is showing:

Incomplete filter FBO: 36055

__exceptionPreprocess + 130 objc_exception_throw + 38 +[NSException raise:format:] -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 90 ----> -[GPUImageMovieWriter createDataFBO] -[GPUImageMovieWriter setFilterFBO] -[GPUImageMovieWriter renderAtInternalSize] -[GPUImageMovieWriter newFrameReadyAtTime:atIndex:]

OlyRice avatar Apr 12 '14 15:04 OlyRice

Is this down to a video having no audio then?

OlyRice avatar Apr 12 '14 15:04 OlyRice

Same issue happening here

ThePragmaticArt avatar May 09 '14 02:05 ThePragmaticArt

I experienced the same with video with no audio. and solved it with dovtuan's solution

This works great for me

if ([[anAsset tracksWithMediaType:AVMediaTypeAudio] count] > 0){ _movieFile.audioEncodingTarget = _movieWriter; } else {//no audio _movieFile.audioEncodingTarget = nil; }

techchee avatar May 15 '14 01:05 techchee

I'm suffering from this problem too . I use the latest library to filter a video file , and i got
*** Assertion failure in -[GPUImageMovieWriter createDataFBO] on GPUImageMovieWriter.m:571

it was randomly given , once it occured , it will occur again even though i kill the process . I think there is something wrong with the FrameBuffer cache .

mookhf avatar Sep 23 '14 11:09 mookhf

@techchee got the right point

or similiar

NSError *audioLoadError; AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:self.tempMoviePath] error:&audioLoadError];

tuo avatar Dec 17 '14 10:12 tuo

Got this issue fixed with @dovtuan solution .

code example: importedMovieWriter.shouldPassthroughAudio = YES; importedMovie.audioEncodingTarget = [videoAsset hasAudioTrack] ? importedMovieWriter : nil; [importedMovie enableSynchronizedEncodingUsingMovieWriter:importedMovieWriter];

[importedMovieWriter startRecording]; [importedMovie startProcessing];

BTW: I extended AVAsset and added some utility methods like "hasAudioTrack" , but you can do that the old way.

EstebanVallejo avatar Apr 27 '15 18:04 EstebanVallejo

This is still an issue. If i disable audio, it works fine, but that isn't an option.

kylebrowning avatar May 21 '15 18:05 kylebrowning

@kylebrowning did you find a fix for this?

melvynhills avatar Jun 17 '15 21:06 melvynhills

Nope

kylebrowning avatar Jun 17 '15 21:06 kylebrowning

@kylebrowning I just fixed it by using the master branch of the repo. I was using a branch of mine to fix black frames at the beginning of the video...

melvynhills avatar Jun 17 '15 21:06 melvynhills

Great @dovtuan

aiyub007 avatar May 28 '16 09:05 aiyub007

Also encountered the same problem, d3ba24c7-2905-4dfe-8319-cea64328c734 91bfc075-b6a6-4a66-ac68-cfdbcde38e12

yao2030 avatar Jan 03 '17 03:01 yao2030

// this line add solve your problm _movieFile.audioEncodingTarget = nil; importedMovieWriter.shouldPassthroughAudio = YES

ramanihiteshc avatar Jan 08 '19 10:01 ramanihiteshc

I have the same issues, but _movieFile.audioEncodingTarget = nil; do not fix my isuss because in my case AudioTrack.count > 0. And i found the reason is :

  • [assetWriterAudioInput markAsFinish]had call before [GPUImageMovieWriter createDataFBO], so lead to assetWriter.status == failing, [assetWriterPixelBufferInput pixelBufferPool] return NULL,And renderTarget create failed. so we just ensure [GPUImageMovieWriter createDataFBO] call after [assetWriterAudioInput markAsFinish] this bug will be fix. In my case, i inherit GPUImageMoveiWriter and rewrite enableSynchronizationCallbacks method:
#import "GCImageMovieWriter.h"
#import <GPUImage/GPUImage.h>

@implementation GCImageMovieWriter {
    BOOL videoBeganEncoding, videoEncodingIsFinished, audioEncodingIsFinished;
    dispatch_queue_t audioQueue, videoQueue;
}

@synthesize videoInputReadyCallback;
@synthesize audioInputReadyCallback;
@synthesize paused = _paused;

- (void)enableSynchronizationCallbacks {
    ///!!!: 修复音频轨没有数据的bug
    // https://github.com/BradLarson/GPUImage/issues/1276
    videoBeganEncoding = NO;
    if (videoInputReadyCallback != NULL)
    {
        if( assetWriter.status != AVAssetWriterStatusWriting )
        {
            [assetWriter startWriting];
        }
        videoQueue = dispatch_queue_create("com.sunsetlakesoftware.GPUImage.videoReadingQueue", NULL);
        [assetWriterVideoInput requestMediaDataWhenReadyOnQueue:videoQueue usingBlock:^{
            if( _paused )
            {
                //NSLog(@"video requestMediaDataWhenReadyOnQueue paused");
                // if we don't sleep, we'll get called back almost immediately, chewing up CPU
                usleep(10000);
                return;
            }
            //NSLog(@"video requestMediaDataWhenReadyOnQueue begin");
            while( assetWriterVideoInput.readyForMoreMediaData && ! _paused )
            {
                BOOL hasVideoEncoding = videoInputReadyCallback();
                if (hasVideoEncoding) {
                    videoBeganEncoding = YES;
                }
                if( videoInputReadyCallback && ! hasVideoEncoding && ! videoEncodingIsFinished )
                {
                    runAsynchronouslyOnContextQueue(_movieWriterContext, ^{
                        if( assetWriter.status == AVAssetWriterStatusWriting && ! videoEncodingIsFinished )
                        {
                            videoEncodingIsFinished = YES;
                            [assetWriterVideoInput markAsFinished];
                        }
                    });
                }
            }
            //NSLog(@"video requestMediaDataWhenReadyOnQueue end");
        }];
    }
    
    if (audioInputReadyCallback != NULL)
    {
        audioQueue = dispatch_queue_create("com.sunsetlakesoftware.GPUImage.audioReadingQueue", NULL);
        [assetWriterAudioInput requestMediaDataWhenReadyOnQueue:audioQueue usingBlock:^{
            if( _paused )
            {
                //NSLog(@"audio requestMediaDataWhenReadyOnQueue paused");
                // if we don't sleep, we'll get called back almost immediately, chewing up CPU
                usleep(10000);
                return;
            }
            //NSLog(@"audio requestMediaDataWhenReadyOnQueue begin");
            while( assetWriterAudioInput.readyForMoreMediaData && ! _paused )
            {
                if( audioInputReadyCallback && ! audioInputReadyCallback() && ! audioEncodingIsFinished )
                {
                    runAsynchronouslyOnContextQueue(_movieWriterContext, ^{
                        if( assetWriter.status == AVAssetWriterStatusWriting && ! audioEncodingIsFinished && videoBeganEncoding )
                        {
                            audioEncodingIsFinished = YES;
                            [assetWriterAudioInput markAsFinished];
                        }
                    });
                }
            }
            //NSLog(@"audio requestMediaDataWhenReadyOnQueue end");
        }];
    }   
}
@end

blog: https://hql-yunyunyun.github.io/GPUImage-Incomplete-filter-FBO-36055-bug修复记录/

HQL-yunyunyun avatar Apr 15 '19 12:04 HQL-yunyunyun