gpt4 book ai didi

ios - 捕获 iOS 模拟器视频以进行应用程序预览

转载 作者:行者123 更新时间:2023-11-29 05:49:36 24 4
gpt4 key购买 nike

好的,我们现在可以在 App Store 上提交应用程序的视频预览了。根据 Apple 的说法,我们应该使用 iOS8 设备和 OSX 10.10。 问题是您必须拥有所有不同的设备(4 英寸、4.7 英寸、5.5 英寸和iPad)。

有替代方案吗?

我正在考虑捕捉模拟器的视频。问题是,以 100% 分辨率显示时,设备屏幕比我的 FullHD 显示器大。有什么解决方案可以直接从模拟器中以全分辨率捕获视频吗?

编辑:既然很多人都在回答我的问题,我就不问了,我说: - 记录一种设备的大小并缩放它不是我所要求的; - 如何记录任何应用程序预览不是我要问的;- 我问的不是你如何进行预览;

要问的是如果屏幕不适合,您能否以 100% 分辨率从模拟器录制视频?

最佳答案

适用于 Xcode 8.2 或更高版本

You can take videos and screenshots of Simulator using the xcrun simctl, a command-line utility to control the Simulator

  1. 在模拟器上运行您的应用

  2. 打开终端

  3. 运行命令

    • 截取屏幕截图

      xcrun simctl io booted screenshot <filename>.<file extension>

      例如:

      xcrun simctl io booted screenshot myScreenshot.png

    • 拍摄视频

      xcrun simctl io booted recordVideo <filename>.<file extension>

      例如:

      xcrun simctl io booted recordVideo appVideo.mov

  4. ctrl + C 停止录制视频。

The default location for the created file is the current directory.

Xcode 11.2 及更高版本提供了额外的选项。

来自 Xcode 11.2 Beta 发行说明

simctl video recording now produces smaller video files, supports HEICcompression, and takes advantage of hardware encoding support whereavailable. In addition, the ability to record video on iOS 13, tvOS13, and watchOS 6 devices has been restored.

您可以使用其他标志:

xcrun simctl io --help
Set up a device IO operation.
Usage: simctl io <device> <operation> <arguments>

...

recordVideo [--codec=<codec>] [--display=<display>] [--mask=<policy>] [--force] <file or url>
Records the display to a QuickTime movie at the specified file or url.
--codec Specifies the codec type: "h264" or "hevc". Default is "hevc".

--display iOS: supports "internal" or "external". Default is "internal".
tvOS: supports only "external"
watchOS: supports only "internal"

--mask For non-rectangular displays, handle the mask by policy:
ignored: The mask is ignored and the unmasked framebuffer is saved.
alpha: Not supported, but retained for compatibility; the mask is rendered black.
black: The mask is rendered black.

--force Force the output file to be written to, even if the file already exists.

screenshot [--type=<type>] [--display=<display>] [--mask=<policy>] <file or url>
Saves a screenshot as a PNG to the specified file or url(use "-" for stdout).
--type Can be "png", "tiff", "bmp", "gif", "jpeg". Default is png.

--display iOS: supports "internal" or "external". Default is "internal".
tvOS: supports only "external"
watchOS: supports only "internal"

You may also specify a port by UUID
--mask For non-rectangular displays, handle the mask by policy:
ignored: The mask is ignored and the unmasked framebuffer is saved.
alpha: The mask is used as premultiplied alpha.
black: The mask is rendered black.

现在您可以在 jpeg 中截图,带有 mask (用于非矩形显示器)和一些其他标志:

xcrun simctl io booted screenshot --type=jpeg --mask=black screenshot.jpeg

关于ios - 捕获 iOS 模拟器视频以进行应用程序预览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55819642/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com