How to change video orientation for AVCaptureVideoDataOutput

后端 未结 2 1729
一向
一向 2020-12-28 20:02


Here\'s the problem. I am using AVCaptureVideoDataOutput to get video frames from camera and make video from them with AVAssetWriter. Its working OK, but the video that

2条回答
  •  误落风尘
    2020-12-28 20:38

    I ran into the same problem and poked around the AVCamDemo from WWDC. I don't know why (yet) but if you query your videoConnection right after you create all the inputs/outputs/connections then both isVideoOrientationSupported and supportsVideoOrientation return NO.

    However, if you query supportsVideoOrientation or isVideoOrientationSupported at some later point (after the GUI is setup for instance) then it will return YES. For instance I query it right after the user clicks the record button just before I call [[self movieFileOutput] startRecordingToOutputFileURL...]

    Give it a try, works for me.

提交回复
热议问题