Swift: video records at one size but renders at wrong size

前端 未结 2 1293
忘了有多久
忘了有多久 2020-12-01 23:47

The goal is to capture full screen video on a device with Swift. In the code below, video capture appears to happen at full screen (while recording the camera preview uses t

相关标签:
2条回答
  • 2020-12-02 00:21

    If I get you right, it seems that you have misunderstood the fact that device screen width is'n equal to camera preview (and capture) size.

    The videoGravity property of your previewLayer indicates how to stretch/fit your preview inside your layer. It doesn't affect capture output.

    Actual frame size of output depends on sessionPreset property of your current AVCaptureSession. And as I can understand by reading GitHub repository of PBJVision lib, its singleton has setter for this (called captureSessionPreset). You can change it inside your initPBJVision method.

    There you can find possible values of session presets.

    0 讨论(0)
  • 2020-12-02 00:31

    Try SDAVAssetExportSession

    You can specify the AVVideoWidthKey and AVVideoHeightKey You can also specify the profile, AVVideoProfileLevelKey ie AVVideoProfileLevelH264HighAutoLevel for supporting something 4k, a friend (Michael Lowin) tracked that property down to help us improve some export qualities.

    0 讨论(0)
提交回复
热议问题