2

I have one local video file, Now i have applied filters with help of GPUImage library, here is code to make filtered video with GPUImage

movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
pixellateFilter = [[GPUImagePixellateFilter alloc] init];
GPUImageRotationFilter *rotationFilter = [[GPUImageRotationFilter alloc] initWithRotation:kGPUImageRotateRight];

[movieFile addTarget:rotationFilter];
[rotationFilter 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 startRecording];
[movieFile startProcessing];

[pixellateFilter removeTarget:movieWriter];
[movieWriter finishRecording];

Now i want to apply frame on this video file, i mean i have fetch naturalSize of video file. And want to apply frame with naturalSize on this video file.

How can i do ? Is it possible ?

Regards,

******** Solved ********* Add image on video that's not possible with GPUImage as per my limit.. many thanks to this link

Community
  • 1
  • 1
Solid Soft
  • 1,872
  • 2
  • 25
  • 55

1 Answers1

0

Yes, you can fetch natural Size of video file by following code.. by @mayur-shrivas as per GPUImage : Apply filer to existing video file

AVURLAsset *asset = [AVURLAsset URLAssetWithURLNSURL fileURLWithPath:pathToMovie] options:nil];
AVAssetTrack *videoAssetTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(videoAssetTrack.naturalSize.width, videoAssetTrack.naturalSize.height)];
Community
  • 1
  • 1
g212gs
  • 863
  • 10
  • 26