Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPUImage ios7 filtering live video memory error #1203

Open
usmayoung opened this issue Sep 20, 2013 · 17 comments
Open

GPUImage ios7 filtering live video memory error #1203

usmayoung opened this issue Sep 20, 2013 · 17 comments

Comments

@usmayoung
Copy link

Brad,

Your library is really amazing. I've had success using it in the past; however, recently I updated my project to xcode5 and ios7, and now my live filters cause my app to receive memory errors. When I run the same build on an ios6 device, it works with no errors, even with 10 live preview filters running at one time. I'm not sure if i'm doing something wrong. I lowered AVCaptureSessionPreset352x288, but it still does not work very well. What has changed from ios6 and 7 to cause this difference?

@programmingthomas
Copy link

I think I'm receiving a similar problem to you here.

@BradLarson
Copy link
Owner

@programmingthomas As I explain there, this is a different issue entirely.

@imclean
Copy link

imclean commented Sep 24, 2013

I have the same issue, iOS6 works fine, iOS7 after 5 seconds recording I just get this constantly:
2013-09-24 14:04:47.012 [491:1803] Problem appending audio buffer at time: {4502639391333/1000000000 = 4502.639}
2013-09-24 14:04:47.038 [491:1603] Problem appending pixel buffer at time: {4502651487534/1000000000 = 4502.651}

Nothing has changed.

@BradLarson
Copy link
Owner

@imclean Is that accompanied by a memory warning? That error message is triggered when the movie writer is unable to record to disk, which can be caused by a number of factors. The most common used to be due to more than one frame being written with non-sequential times (due to multiple movies or video source being blended together, each slightly out of sync with the other), or odd queue scheduling issues.

This may not be memory-related, but might be due to a recurrence of one of the above problems that I thought had been solved earlier.

@imclean
Copy link

imclean commented Sep 24, 2013

Hi @BradLarson I have a set of live preview views which I remove before I start recording, I don't think this is related however as I have removed them all and I still have this issue. It doesn't do it in iOS6.

I create a bunch of filters in my init and add them to an array (some are filter groups), then when the view loads I create the views for each filter (GPUImageViews) like so (in a custom collection view's viewForItemAtIndex):

view = [[GPUImageView alloc] initWithFrame:CGRectMake(0, 0, 150.0f, 86.0f)];
id filtered = [filtersArray objectAtIndex:index];
[videoCamera addTarget:filtered];
[filtered addTarget:(GPUImageView_)view];
[filtersVideoViews replaceObjectAtIndex:index withObject:view];
videoCamera.horizontallyMirrorFrontFacingCamera = NO;
videoCamera.horizontallyMirrorRearFacingCamera = NO;
[(GPUImageView_)view setFillMode:kGPUImageFillModePreserveAspectRatio];
view.layer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);

When someone choses one of these view by selecting it, I just swap out the main filter for one of these.

When recording starts I have this:
// remove all targets from the filters on the preview views
for (int i = 0; i<[filtersArray count]; i++) {
if([[filtersArray objectAtIndex:i]isKindOfClass:[GPUImageFilter class]]){
[(GPUImageFilter_)[filtersArray objectAtIndex:i]removeAllTargets];
}else if([[filtersArray objectAtIndex:i]isKindOfClass:[GPUImageFilterGroup class]]){
[(GPUImageFilterGroup_)[filtersArray objectAtIndex:i]removeAllTargets];
}
}
//remove and empty all arrays
[filtersArray removeAllObjects];
[filtersVideoViews removeAllObjects];

//clean everything out and add the main chosen filter
[videoCamera removeAllTargets];
[videoCamera addTarget:filter];

Sometimes the recording works, but 90% of the time after around 3-5 seconds I get the messages above.

Thanks so much for getting back to me, I understand how little time you may have for supporting issues like this.

@lyleyang
Copy link
Contributor

HI @imclean @BradLarson , I have the same issue, in device iPhone5 & iOS7 after 5 seconds recording sometime appendPixelBuffer failed. but in iTouch 5G & iOS7 or iPhone4S & iOS7 don't failed.

@imclean
Copy link

imclean commented Sep 26, 2013

yip @lyleyang @BradLarson , this is not memory related, this is something else. just breaks the code, records black. Nothing to do with filter either, basically an ios7 issue. I've started to change over to GLKit and iOS7 CIFilters.

@KarenHu196
Copy link

I have the same issue as well. I have modified the SimpleVideoFilter to encode a live video and audio to MP4 file. After about 5 seconds, I start to get appendPixelBuffer and appendSampleBuffer errors. I have tried to drop frame that have time out of order but that doesn't help. The error info from AVAssetWriter are as follows:

_userInfo __NSDictionaryI * 3 key/value pairs 0x005c6140
0 @"NSLocalizedDescription" : @"The operation could not be completed"
1 @"NSUnderlyingError" : error: summary string parsing error
2 @"NSLocalizedFailureReason" : @"An unknown error occurred (-12780)"

This issue happens more often if I have more audio input.

@colinhebe
Copy link

I have the same issue too. iPhone 5s is not good. iPhone 4s is good.
When I reboot the device iPhone 5s. It must happened after 3 seconds. iOS 7.0.4.
After that it happened randomly.

Need your help!

@CALohse
Copy link

CALohse commented Jan 16, 2014

I am also seeing same issue. All was good until update from iOS6 to iOS 7.0.4. Also, getting different behaviors on three different versions of iPads all running iOS 7.0.4. iPad 3, works perfectly fine. iPad4 is sporadic and when it fails it records for about 2 seconds then I get the appending pixel buffer error:
Problem appending pixel buffer at time: {253/30 = 8.433, rounded}

Briefly tested on ipad air and I am never able to record.

I recently updated GPUImage to the latest commit and iPad 3 does not fail, but recorded playback is a black screen. iPad 4 now no longer records sporadically, but fails ever time with appending pixel buffer at time error.

Any ideas?

Thanks,

@beeradmoore
Copy link

I am getting black screens at times when changing GPUImageHSBFilter settings around, even after calling reset on the GPUImageHSBFilter.

@naotokui
Copy link

I had the same issue when I tested SimpleVideoFilter sample project. It worked fine with AVFileTypeQuickTime format. Once I switched to AVFileTypeMPEG4, however, I started to see this "Problem appending pixel buffer at time: ..." error once in every 3 to 5 trials. Any known workaround? I'm on iOS 7 / iPhone 5s. It worked well on iOS 6 and/or iPod touch.

@naotokui
Copy link

I think I found a workaround!

I set AVVideoProfileLevelKey to AVVideoProfileLevelH264BaselineAutoLevel (or Baseline41, Baseline40, Baseline30) then the sample worked well!! AVVideoProfileLevelH264MainAutoLevel, AVVideoProfileLevelH264HighAutoLevel didn't work.

It apparently has something to do with H.264 compression. If I'm not mistaken, Baseline profile is less processor intensive than Main or High profile, right?

@acrookston
Copy link

@naotokui thanks! I've been stuck with this same problem, that really solved it!

@zmzhuai
Copy link
Contributor

zmzhuai commented Apr 10, 2014

@naotokui thanks! I solved this problem with U tips!

@aidenluo177
Copy link
Contributor

@naotokui thanks! You save me!!

@ginoOwnits
Copy link

THANK YOU! works well with autolevel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests