BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.25k stars 4.61k forks source link

GPUImage save video resolution #2283

Closed SeptJY closed 8 years ago

SeptJY commented 8 years ago

I set the video resolution by this way, set up the effect is there, but in the same time to save the video with the same time the size of the resolution is indeed different, it seems that only the resolution of 640x480

BradLarson commented 8 years ago

I'm not sure what you're asking here. Are you saying that your video is recording at 640x480? Make sure that you aren't setting your movie write to only output at that resolution.

SeptJY commented 8 years ago

I use GPUImage set 640x480, 1280x720, 1920x1080, 3840x2160 resolution recorded 10 seconds of video memory occupied by the same size, the video bit rate is the same @BradLarson

SeptJY commented 8 years ago

NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:videoSize.width], AVVideoCleanApertureWidthKey, [NSNumber numberWithInt:videoSize.height], AVVideoCleanApertureHeightKey, [NSNumber numberWithInt:0], AVVideoCleanApertureHorizontalOffsetKey, [NSNumber numberWithInt:0], AVVideoCleanApertureVerticalOffsetKey, nil];

NSDictionary *videoAspectRatioSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                          [NSNumber numberWithInt:3], AVVideoPixelAspectRatioHorizontalSpacingKey,
                                          [NSNumber numberWithInt:3], AVVideoPixelAspectRatioVerticalSpacingKey,
                                          nil];

NSMutableDictionary * compressionProperties = [[NSMutableDictionary alloc] init];
[compressionProperties setObject:AVVideoCodecH264 forKey:AVVideoCodecKey];
[compressionProperties setObject:[NSNumber numberWithInt:videoSize.width] forKey:AVVideoWidthKey];
[compressionProperties setObject:[NSNumber numberWithInt:videoSize.height] forKey:AVVideoHeightKey];
[compressionProperties setObject:videoCleanApertureSettings forKey:AVVideoCleanApertureKey];
[compressionProperties setObject:videoAspectRatioSettings forKey:AVVideoPixelAspectRatioKey];
[compressionProperties setObject:[NSNumber numberWithInt: 2000000] forKey:AVVideoAverageBitRateKey];
[compressionProperties setObject:[NSNumber numberWithInt: 16] forKey:AVVideoMaxKeyFrameIntervalKey];
[compressionProperties setObject:AVVideoProfileLevelH264Main31 forKey:AVVideoProfileLevelKey];

[outputSettings setObject:compressionProperties forKey:AVVideoCompressionPropertiesKey];

This section of the GPUImageMovieWriter.m file in the code of the notes I simply studied, this is the set of video bit rate? Can use this to set the video bit rate @BradLarson

BradLarson commented 8 years ago

Where's the code for where you initialize your GPUImageMovieWriter? You have to set size as one of its parameters, so are you setting the size to something other than 640x480?