ios - video filter via GPUImageMovie not played clean video -
ios - video filter via GPUImageMovie not played clean video -
i add together gpuimage framework video editing in project, can't play video clean (as per screen shot) checked illustration in gpuimage framework i.e. "simplevideofilefilter", have same issue , sound clean , , save easily(movie author code not show here) checked different video format i.e. "mp4", "mov", "m4v" have same issue
my code below,
.h file
#import <uikit/uikit.h> #import <gpuimage.h> #import <avfoundation/avfoundation.h> @interface viewcontroller : uiviewcontroller<gpuimagemoviedelegate> @end
and .m file following
#import "viewcontroller.h" @interface viewcontroller () { gpuimagemovie *moviefile; gpuimageoutput<gpuimageinput> *filter; gpuimagemoviewriter *moviewriter; } @property (nonatomic,strong) gpuimageview *gpuimageviewobj; @property (nonatomic,strong) avplayer *player; @property (nonatomic,strong) avplayeritem *playeritem; @end @implementation viewcontroller @synthesize gpuimageviewobj,player,playeritem; - (void)viewdidload { [super viewdidload]; gpuimageviewobj = [[gpuimageview alloc] initwithframe:cgrectmake(0, 0, 568, 320)]; [self.view addsubview:gpuimageviewobj]; [self try128]; } -(void)try128{ //avplayer nsurl *sampleurl = [[nsbundle mainbundle] urlforresource:@"sample" withextension:@"m4v"]; playeritem = [[avplayeritem alloc]initwithurl:sampleurl]; player = [[avplayer alloc ]initwithplayeritem:playeritem]; [player play]; //gpuimage film moviefile = [[gpuimagemovie alloc] initwithplayeritem:playeritem]; // moviefile.runbenchmark = yes; moviefile.playatactualspeed = yes; moviefile.delegate = self; //filter filter = [[gpuimagefilter alloc] init]; [filter forceprocessingatsize:gpuimageviewobj.sizeinpixels]; [moviefile addtarget:filter]; [filter addtarget:gpuimageviewobj]; [moviefile startprocessing]; player.actionatitemend = avplayeractionatitemendnone; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(didcompleteplayingmovie) name:avplayeritemdidplaytoendtimenotification object:nil]; } #pragma mark - gpuimagemoviedelegate -(void)didcompleteplayingmovie { [[nsnotificationcenter defaultcenter] removeobserver:self name:avplayeritemdidplaytoendtimenotification object:nil]; [filter removetarget:moviewriter]; // [moviefile endprocessing]; //not needed nslog(@"finish............"); } #pragma mark -gpuimagemoviewriterdelegate - (void)movierecordingcompleted{ nslog(@"movierecordingcompleted called..."); // [moviewriter finishrecording]; } - (void)movierecordingfailedwitherror:(nserror*)error{ nslog(@"movierecordingfailedwitherror called..."); }
my o/p images
i'm guessing you're trying run in simulator, not on actual device. film playback has never worked correctly on simulator, , 1 artifact of that.
instead, development on actual ios hardware.
ios video ios7 gpuimage video-editing
Comments
Post a Comment