Comments (4)
Hi @imackinn! Thanks for the complements.
So the current video resolution and compression settings are actually very similar to Vine. I have these settings maxed out based on testing across a sampling of devices and device types. You can bump up the resolution and/or reduce the amount of compression, but then you'll encounter situations where the videos drop frames or you create much larger files than you'd want to transfer.
You're not the only one that's asked me about this, so I may expose some enums where folks can pick how much compression they want. It may be good to do once faster hardware is more common, (iPhone 5S and beyond).
If you want to try it on your own, these are the lines you modify to change compression (i've left some of my other settings commented out for reference):
- (BOOL)_setupAssetWriterVideoInput:(CMFormatDescriptionRef)currentFormatDescription
{
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(currentFormatDescription);
// lower the bitRate, higher the compression, lets compress for 480 x 360 even though we record at 640 x 480
// 87500, good for 480 x 360
// 437500, good for 640 x 480
float bitRate = 87500.0f * 8.0f;
NSInteger frameInterval = 30;
Video resolution can be adjusted with using other presets:
// specify video preset
sessionPreset = AVCaptureSessionPreset640x480;
Hope that helps.
from pbjvision.
// lower the bitRate, higher the compression, lets compress for 480 x 360 even though we record at 640 x 480
// 87500, good for 480 x 360
// 437500, good for 640 x 480
@piemonte , how did you get those numbers? Any specific formula?
from pbjvision.
@piemonte Would you mind sharing the default settings that were used to create "compression settings similar to Vine" like in your comment?
I've modified all of mine and it's producing extremely high quality video but the file sizes are very large.
from pbjvision.
For anyone who's curious, here are my current settings for capturing the highest quality video:
vision.cameraMode = PBJCameraModeVideo;
vision.cameraOrientation = PBJCameraOrientationPortrait;
vision.focusMode = PBJFocusModeContinuousAutoFocus;
vision.outputFormat = PBJOutputFormatPreset;
vision.captureSessionPreset = AVCaptureSessionPresetHigh;
The only problem is that a 4 minute video recorded with these settings will be around 100 MB which is ridiculous. I'm uploading these to an AWS S3 bucket and even on wifi the uploads feel pretty slow.
I really need to find a way to reduce the file size but still keep some quality.
Here are some code comments I left myself 3 weeks ago:
// AVCaptureSessionPresetHigh w/ a lower bitrate of PBJVideoBitRate480x360 looks good
// while they are recording, but then when you go to play it, it looks terrible eg. fuzzy
// especially if moving the camera while recording.
from pbjvision.
Related Issues (20)
- Separate Mirroring Modes for Preview vs Capture? HOT 1
- PBJMediaWriter crash on endVideoCapture HOT 2
- iOS 10 issues HOT 1
- iPhone 7
- Flip camera while recording causes audio sync issues HOT 3
- - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection HOT 2
- Library create problem for ios 10 HOT 3
- Upgraded library not working HOT 1
- refactor device management to address reported issues
- How capture slow-mo with PBJVision ? HOT 4
- Frame loss at capturing start HOT 2
- Deployment target HOT 2
- PBJVisionUtilities convertToPointOfInterestFromViewCoordinates changes HOT 1
- on ios7.x crash help me thx
- Cannot remove an observer
- Text in capture video HOT 3
- Capture from both cameras simultaneously HOT 1
- Capturing a photo is not working, but video is
- fetch video PHAsset - by PBJMediaWriter.outputURL ("tmp")
- Does anyone have a sample Swift Project using this?? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pbjvision.