我们最近刚刚为我们的一个系统创建了一个 iPhone 应用程序,允许用户将图片和视频内容上传到我们的服务。我们遇到的最后一个主要问题是如何处理以水平向右以外的方向上传的视频。显然,如果您的播放系统不考虑随视频发送的方向标志,那么它将倒置或横向播放。
正确的方法似乎是播放系统应该在播放之前考虑方向标志。这是 Apple 直接在设备上以及通过 Quicktime 处理它的方式。
所以我的第一个希望是有人知道基于网络(HTML5 或 Flash)的播放器,它能够在播放期间根据视频方向元数据或传递的标志旋转视频(我们已经有必要的标志可用数据库,如果我们需要手动传递它)。如果您知道任何这样的玩家,请分享!
如果您不知道这样的播放器,那么有没有人有幸使用 FFMPEG 或 MEncoder 旋转他们的视频?上周我们进行了几个小时的测试,但未能从那里提到的两个重量级选手那里得到任何体面的结果。
如果所有这些都失败了,是否可以让 iPhone 在指定方向上传视频或图像?
这三个中的任何一个都对我有用,但我更愿意做任何标准的事情(如果存在的话)。
任何帮助深表感谢!
最佳答案
Maybe I am missing what you asking but if you are using ffmpeg on the iPhone or android which uses opengl couldn't you read the metadata in the stream and adjust the orientation accordingly with glrotate, we had a similar issue on the ipad/iphone when someone changes the orientation. We watch for the orientation change notification and rotate the display.
#ifdef LANDSCAPE
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
#ifdef __IPAD__
printf("got to ipad");
glViewport(0, 0, 768, 1024);
if (isFlipped())
glRotatef(90, 0, 0, 1);
else
glRotatef(-90, 0, 0, 1);
glOrthof(0.0, (GLfloat) 1024, (GLfloat) 768, 0.0, 0, 100.0f);
#else
glViewport(0, 0, 320, 480);
if (isFlipped())
glRotatef(90, 0, 0, 1);
else
glRotatef(-90, 0, 0, 1);
glOrthof(0.0, (GLfloat) 480, (GLfloat) 320, 0.0, 0, 100.0f);
#endif
#else
data->glMatrixMode(GL_PROJECTION);
data->glLoadIdentity();
data->glMatrixMode(GL_MODELVIEW);
data->glLoadIdentity();
data->glViewport(0, 0, window->w, window->h);
data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0,
0, 1.0);
#endif
data->updateSize = SDL_FALSE;
}
You can also check out or iOS video player project for ways to extract metadata from the video stream.
www.mooncatventures.org/mediawiki
关于flash - 带有方向标志的基于 Web 的 iOS 视频播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9154650/