是否可以生成 60 fps 的视频并以 60 fps 播放?

发布于 2024-12-06 12:28:17 字数 132 浏览 0 评论 0原文

为了实现高性能的科学目的,我们需要渲染视频并在设备上以 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

街角迷惘 2024-12-13 12:28:17

技术规格因 iOS 设备而异,因此您需要检查实际运行该程序的硬件。对于目前功能最强大的 iOS 设备 iPad 2,Apple 的视频技术规格列表下列:

支持的视频格式:H.264 视频高达 720p,每秒 30 帧,
Main Profile 级别 3.1,AAC-LC 音频高达 160 Kbps、48kHz、立体声
.m4v、.mp4 和 .mov 文件格式的音频; MPEG-4 视频,最高 2.5
Mbps、640 x 480 像素、每秒 30 帧、简单配置文件
AAC-LC 音频每通道高达 160 Kbps,48kHz,.m4v 立体声音频,
.mp4 和 .mov 文件格式;运动 JPEG (M-JPEG) 高达 35 Mbps, 1280
720 像素,每秒 30 帧,ulaw 音频,PCM 立体声音频
.avi 文件格式

即使在 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:

Video formats supported: H.264 video up to 720p, 30 frames per second,
Main Profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo
audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5
Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with
AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v,
.mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280
by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio
in .avi file format

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.

南城旧梦 2024-12-13 12:28:17

是的,可以将视频编码为一系列图像,然后在屏幕上快速显示图像。视频硬件的上限以及解码图像和将图像传输到视频卡中的时间是此过程的瓶颈。只要你的图像解码逻辑不是太慢,应该可以以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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文