Square video using AVFoundation

2019-02-15 21:56发布

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条回答
做自己的国王
2楼-- · 2019-02-15 22:43

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

查看更多
登录 后发表回答