是否可以生成 60 fps 的视频并以 60 fps 播放?
为了实现高性能的科学目的,我们需要渲染视频并在设备上以 60 fps 的速度播放。我假设 H.264 视频的通常帧速率低于该值。
这可能吗,还是帧率是固定的?如果是的话,在设备上全屏播放 H.264 视频时可以获得的最大帧速率是多少?
For a high-performance scientific purpose we need to render video and play it at 60fps on the device. I assume the usual frame rate of H.264 video is lower than that.
Is this possible, or is the framerate fixed? If so, what is the maximum frame rate we can get when playing H.264 video in fullscreen on the device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
技术规格因 iOS 设备而异,因此您需要检查实际运行该程序的硬件。对于目前功能最强大的 iOS 设备 iPad 2,Apple 的视频技术规格列表下列:
即使在 iPad 2 的强大硬件上,似乎也不支持以 60 FPS 的全屏 H.264 播放。
但是,您确实可以以 60 FPS 的速度将内容渲染到屏幕上。我一直在核心动画重型应用程序和使用 OpenGL ES 的应用程序中执行此操作。如果您可以在应用程序中以足够快的速度生成内容以按此速率显示,则可以将其以 60 FPS 渲染到屏幕上,然后将每隔一帧编码为视频。
鉴于视频编码是一项相当昂贵的操作,而且听起来您也想在这里运行某种模拟,我猜您将无法以 60 FPS 渲染每个帧以显示在屏幕上当前的硬件仅仅是由于您将施加在系统上的负载。
Technical specifications will vary from iOS device to iOS device, so you'll need to check for the hardware you'll actually run this on. For the iPad 2, currently the most powerful of the iOS devices, Apple's technical specifications for video list the following:
It would appear that fullscreen H.264 playback at 60 FPS is not supported on even the robust hardware of the iPad 2.
However, you can indeed render content to the screen at 60 FPS. I do this all the time in both Core Animation heavy applications and ones that use OpenGL ES. If you can generate your content in-application fast enough to display at this rate, you could render it to the screen at 60 FPS, then encode every other frame to video.
Given that video encoding is a reasonably expensive operation, and it sounds like you want to run some kind of simulation here as well, I'm guessing that you won't be able to render each frame at 60 FPS for display to the screen on current hardware simply due to the load you'll put on the system.
是的,可以将视频编码为一系列图像,然后在屏幕上快速显示图像。视频硬件的上限以及解码图像和将图像传输到视频卡中的时间是此过程的瓶颈。只要你的图像解码逻辑不是太慢,应该可以以60FPS的速度将视频数据推送到显卡。
您可以尝试使用一系列 PNG 图像自行实现这一点,但我认为您会发现解码 PNG 图像的速度不够快,无法获得 60 FPS 播放。您可以在我对 这个问题
如果你无法获得你需要的性能,那么看看我的 iOS AVAnimator 库,因为它已经完全解决了这个问题使用可以从映射内存直接发送到视频卡的内存映射帧。
Yes, it is possible to encode video as a series of images and then display the images very quickly on screen. The upper limit of the video hardware and the time to decode the images and blit the images into the video card are the bottleneck in this process. As long as your image decoding logic is not too slow, it should be possible to push video data to the graphics card at 60FPS.
You could try to implement this yourself with a series of PNG images, but I think you will find that decoding the PNG image will not be fast enough to get 60 FPS playback. You can find some free example code that implements that approach with PNG images in my answer to this question
If you cannot get the performance you need, then take a look at my AVAnimator library for iOS, as it already fully solves this problem using memory mapped frames that can be sent directly to the video card from mapped memory.