avassetwriterinput

Record video with AVAssetWriter: first frames are black

蹲街弑〆低调 提交于 2020-01-03 13:37:23
问题 I am recording video (the user also can switch to audio only) with AVAssetWriter . I start the recording when the app is launched. But the first frames are black (or very dark). This also happens when I switch from audio to video. It feels like the AVAssetWriter and/or AVAssetWriterInput are not yet ready to record. How can I avoid this? I don't know if this is a useful info but I also use a GLKView to display the video. func start_new_record(){ do{ try self.file_writer=AVAssetWriter(url:

How to set expected framerate to AVAssetWriterInput

戏子无情 提交于 2020-01-02 07:41:30
问题 I have an app which encodes videos in different ways and saves it to Photos library - it can cut specific time range, add pictures, text, etc. Everything is working perfectly till I try to encode video 120+ fps. The problem is that video appears to be slow-motioned and I don't pursue that goal at all. Here I found out about property for AVAssetWritterInput which is called AVVideoExpectedSourceFrameRateKey , but the problem is that when I try to apply this parameter to my AVAssetWritterInput ,

iOS how to correctly handle orientation when capturing video using AVAssetWriter

半腔热情 提交于 2019-12-10 11:28:42
问题 I am making a sample application that utilizes AVFoundation to record video. The whole point is so I can have more control over how the video is recorded. In my sample project I have the video capturing but am struggling with handling orientation correctly. I have done a lot of searching around the web and found that others are suggesting that I should NOT allow my capture view or capture session to rotate based on orientation, but rather set a transformation to rotate the video during

iOS how to correctly handle orientation when capturing video using AVAssetWriter

爱⌒轻易说出口 提交于 2019-12-06 07:16:57
I am making a sample application that utilizes AVFoundation to record video. The whole point is so I can have more control over how the video is recorded. In my sample project I have the video capturing but am struggling with handling orientation correctly. I have done a lot of searching around the web and found that others are suggesting that I should NOT allow my capture view or capture session to rotate based on orientation, but rather set a transformation to rotate the video during playback. I have this working fine on iOS and Mac devices, but am wondering if I will have issues on other

How to set expected framerate to AVAssetWriterInput

烂漫一生 提交于 2019-12-05 22:05:57
I have an app which encodes videos in different ways and saves it to Photos library - it can cut specific time range, add pictures, text, etc. Everything is working perfectly till I try to encode video 120+ fps. The problem is that video appears to be slow-motioned and I don't pursue that goal at all. Here I found out about property for AVAssetWritterInput which is called AVVideoExpectedSourceFrameRateKey , but the problem is that when I try to apply this parameter to my AVAssetWritterInput , I'm getting this error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException',