Giter Site home page Giter Site logo

Higher Resolution Output about pbjvision HOT 4 CLOSED

piemonte avatar piemonte commented on May 10, 2024
Higher Resolution Output

from pbjvision.

Comments (4)

piemonte avatar piemonte commented on May 10, 2024

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.

comparison

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.

yury avatar yury commented on May 10, 2024

// 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.

mitchellporter avatar mitchellporter commented on May 10, 2024

@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.

mitchellporter avatar mitchellporter commented on May 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.