本文介绍了在iOS中以1:1的宽高比进行视频捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用1:1宽高比的iOS摄像机捕获视频.

I want to capture videos with iOS camera with 1:1 aspect ratio.

我尝试使用UIImagePickerController,但是它不提供更改的宽高比.谁能给我个主意?

I tried with UIImagePickerController, but it don't provide changing aspect ratio.Could anyone give me ideas?

此外,iPhone应用程序"Viddy"提供了1:1的宽高比视频捕获 http://gyazo.com/1ccba9990bb589961f1d5df23b71b84b.png?1364791668

Additionally, iPhone app "Viddy" provides 1:1 aspect ratio video capturinghttp://gyazo.com/1ccba9990bb589961f1d5df23b71b84b.png?1364791668

谢谢!

推荐答案

 GPUImageMovie* movieFile = [[GPUImageMovie alloc] initWithAsset:asset];
    GPUImageCropFilter *cropFilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0.0, 0.1, 1.0, 0.8)];

    [movieFile addTarget:cropFilter];
    GPUImageMovieWriter* movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(320.0, 320.0)];

    [cropFilter addTarget:movieWriter];
    [movieWriter startRecording];
    [movieFile startProcessing]; 
    [movieWriter finishRecordingWithCompletionHandler:^{

               NSLog(@"Completed Successfully");
               [cropFilter removeTarget:movieWriter];
               [movieFile removeTarget:cropFilter];
    }];

位置

  • asset是输入的电影文件.
  • cropRegion是要种植的面积.
  • movieUrl是保存裁剪后的电影的目标URL.
  • asset is the input movie file.
  • cropRegion is the area to crop.
  • movieUrl is the target url to save the cropped movie.

这篇关于在iOS中以1:1的宽高比进行视频捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 16:59