How do I rotate a video from UIImagePickerController before uploading to a webserver

烈酒焚心 提交于 2019-12-22 18:07:32

问题


I'm uploading videos to a web server after choosing the video using the UIImagePickerController. However, videos shot with the camera in landscapeRight orientation are inverted on the server. I want to use AVFoundation to rotate the video before uploading. I've figured out how to get the size and preferredRotation of the video using AVAsset. Now I need to apply an affine transform to the video before uploading.

Here's an example of the size and transform from a landscapeRight video:

2011-01-07 20:07:30.024 MySecretApp[1442:307] size.width = 1280.000000 size.height = 720.000000 2011-01-07 20:07:30.027 MySecretApp[1442:307] txf.a = -1.000000 txf.b = 0.000000 txf.c = 0.000000 txf.d = -1.000000 txf.tx = 1280.000000 txf.ty = 720.000000

How would I transform the video to undo the inversion? I assume that I'd have to export the results to a new file and upload that to the webserver. I'll also have to do a similar conversion to videos shot in portrait to rotate them from landscape so that they are orientated correctly on the server.

Thanks


回答1:


How about using ffmpeg, which can be included as a library linked into your iPhone app?

Here's a duplicate question with the ffmpeg solution detailed.



来源:https://stackoverflow.com/questions/7896742/how-do-i-rotate-a-video-from-uiimagepickercontroller-before-uploading-to-a-webse

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