如何在上传到网络服务器之前从UIImagePickerController旋转视频 [英] How do I rotate a video from UIImagePickerController before uploading to a webserver

查看:124
本文介绍了如何在上传到网络服务器之前从UIImagePickerController旋转视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用UIImagePickerController选择视频后将视频上传到网络服务器。但是,使用相机以landscapeRight方向拍摄的视频会在服务器上反转。我想在上传之前使用AVFoundation旋转视频。我已经想出如何使用AVAsset获取视频的大小和preferredRotation。现在我需要在上传之前对视频应用仿射变换。



以下是来自landscapeRight视频的大小和变换的示例:



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



我将如何变换视频撤消反转?我假设我必须将结果导出到新文件并将其上传到网络服务器。我还必须对以肖像拍摄的视频进行类似的转换,以便从横向旋转它们,以便它们在服务器上正确定位。



谢谢

解决方案

如何使用ffmpeg,它可以作为链接到iPhone应用程序的库包含在内?



'p> 这里是一个重复的问题与详述的FFMPEG溶液。


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

解决方案

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.

这篇关于如何在上传到网络服务器之前从UIImagePickerController旋转视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆