Square video using AVFoundation

淺唱寂寞╮ 提交于 2019-12-09 00:17:58

问题


I followed the given tutorial to create a custom square video recording camera. http://www.netwalk.be/article/record-square-video-ios

I am able to export a square video from this, but when i try to play the newly exported file using the url it does not play.

For the original url ,i tried was working fine and playing properly.

I opened the documents directory of the phone and found that the video was getting cropped and a file was created but playing the video on quicktimeplayer it was appearing very slow and seemed to play in frame by frame manner i.e. too slow. (Don't know whether it was an issue with the player).

Here is a github link for the project. Kindly have a look and correct me.

https://github.com/ankit-betterbutter/CustomCamera

ViewController is the camera view VideoEditorViewController is the view for playing the videos after recording.

Also tell me if you need any more details.

I also went through many other topics showing how to record square video but was not able to grasp them. It would be really helpful if you can provide me a demo if you have implemented something similar.

It will be a great help mates.

Thanks.


回答1:


I have updated the github repository with the code.

These were the errors that I rectified :

  • I was making mistake while creating the url for documents directory hence i was not able to use the video.
  • I was not creating the videoComposition properly. There were issue while creating the CMTimeRange.

Please visit the repository and check for yourself. Also upvote if the code helped you in anyway. Thanks!!

Repo link - https://github.com/ankit-betterbutter/CustomCamera



来源:https://stackoverflow.com/questions/43451879/square-video-using-avfoundation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!