1

I need to change live video resolution with the width and height inputted by user. Sorry for my question but I have never done it before.

Please help.

Lucas Huang
  • 3,998
  • 3
  • 20
  • 29
user
  • 221
  • 1
  • 2
  • 11
  • Yes, You can change resolution of video. Look at this [**answer**](http://stackoverflow.com/questions/11751883/how-can-i-reduce-the-file-size-of-a-video-created-with-uiimagepickercontroller) – Kampai Sep 09 '15 at 07:21

2 Answers2

0

You can change video resolution by using AVMutableVideoComposition and AVAssetExportSession.

First create object of AVMutableVideoComposition shown below.

AVMutableVideoComposition* videoComposition = [AVMutableVideoComposition videoComposition];
videoComposition.frameDuration = CMTimeMake(1, 30);
videoComposition.renderSize = CGSizeMake(YOUR_WIDTH, YOUR_HEIGHT);

Then, create object of AVAssetExportSession,

exporter = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetHighestQuality];
exporter.videoComposition = videoComposition;

And write completionBlock for exporter.

Hope this helps.

Bharat Nakum
  • 647
  • 6
  • 18
0

If you are using OpenTok, you can use a custom video capturer that is mostly identical to the one found in this sample. The only difference is that you would need to additionally write code to scale the image from the CVPixelBuffer (called imageBuffer) to the size which your user is setting.

One way technique to scale the image would be to use the CoreImage APIs as shown here: https://stackoverflow.com/a/8494304/305340

Community
  • 1
  • 1
Ankur
  • 2,792
  • 3
  • 23
  • 26
  • can you please explain a little more? – user Sep 10 '15 at 07:04
  • @user I'm not sure what you need me to explain. Have you looked at the linked sample? Have you understood the linked scaling technique? Do you have any more specific questions regarding those? – Ankur Sep 23 '15 at 03:38