现在我们可以向App Store提交应用的视频预览。根据苹果公司的说法,我们应该在iOS8设备和OSX 10.10设备上这样做。问题是你必须拥有所有不同的设备(4英寸、4.7英寸、5.5英寸和iPad)。

还有别的选择吗?

我想拍一段模拟器的视频。问题是,当以100%分辨率显示时,设备屏幕比我的全高清显示器还大。任何解决方案,可以捕捉视频从模拟器的全分辨率?

编辑: 因为很多人都在回答我没有问的问题让我说 记录一个设备大小并缩放它不是我要求的 我问的不是如何录制应用预览 -我问的不是你怎么做预告片;

我想问的是,如果模拟器无法在屏幕上显示,你能否以100%分辨率录制视频?


当前回答

在Xcode 12中,只需在模拟器中按cmd + R来记录屏幕。cmd + S进行截图。

其他回答

您可以使用以下工具免费完成此工作。你至少需要一台真正的设备(我用的是iPhone 5)。

使用简单但出色的appshow捕获视频(注意,这是一个非常简陋的工具,但非常容易学习)。这将以本机设备分辨率(640x1136)导出。

使用ffmpeg调整大小。由于四舍五入,你可以直接在分辨率之间切换,但你必须超大,然后裁剪。

ffmpeg -i video.mov -filter:v scale=1084:1924 -c:a copy video_1084.mov
ffmpeg -i video_1084.mov -filter:v "crop=1080:1920:0:0" -c:a copy video_1080.mov

对于iPad,你可以裁剪然后添加一个信箱。然而,像这样的裁剪通常不会产生与你的应用程序在iPad上的效果完全相同的视频。YMMV。

ffmpeg -i video.mov -filter:v "crop=640:960:0:0" -c:a copy video_640_960.mo
ffmpeg -i video_640_960.mov -filter:v "pad=768:1024:64:32" -c:a copy video_768_1024.mov
ffmpeg -i video_768_1024.mov -filter:v scale=900:1200 -c:a copy video_900_1200.mov

对于Xcode 8.2或更高版本

您可以使用xcrun simctl(一个命令行实用程序来控制模拟器)拍摄模拟器的视频和屏幕截图

在模拟器上运行应用程序 打开终端 执行命令 截图 xxrun simctl IO启动截图<filename>。<文件扩展名> 例如: xrun simctl io启动截图myScreenshot.png 拍一段视频 xrun simctl io boot recordVideo <filename>. txt<文件扩展名> 例如: xrun simctl io启动recordVideo appVideo.mov 按“ctrl + C”停止录像。

所创建文件的默认位置是当前目录。

Xcode 11.2及以后版本提供了额外的选项。

来自Xcode 11.2 Beta版本说明

simctl视频记录现在产生更小的视频文件,支持HEIC 压缩,并利用硬件编码支持的地方 可用。此外,可以在iOS 13上录制视频,tvOS 13, watchOS 6设备已恢复。

你可以使用额外的标志:

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中截图,带掩码(用于非矩形显示)和一些其他标志:

xrun simctl IO启动截图——type=jpeg——mask=黑色截图

给喜欢使用ZSH函数的用户的提示。您可以通过添加一个与@Tikhonov Alexander的答案相同的函数来简化事情。

你可以这样开始:

edit ~/.zshrc

进入你的终端。

然后在文件中添加这个函数。

function recsim() {
    echo -n "Use CTRL+C to stop recording";
    xcrun simctl io booted recordVideo --codec=h264 --mask=black "$1.mp4";
}

要使用,输入如下内容:

recsim appPreview

进入你的终端窗口。注意:添加功能后必须重新启动终端才能工作。

此函数改编自Antoine Van Der Lee关于如何在bash中实现此功能的博客文章,可以在这里找到。

苹果建议在实际设备上这样做,并提供了如何在iOS和OS X上使用QuickTime和iMovie来做到这一点的指南: https://developer.apple.com/app-store/app-previews/imovie/Creating-App-Previews-with-iMovie.pdf

简介:

捕捉屏幕录音与QuickTime播放器

使用Lightning电缆将iOS设备连接到Mac。 打开QuickTime播放器。 选择“文件>新电影录制”。 在出现的窗口中,选择您的iOS设备作为摄像头和麦克风输入源。

用iMovie创建应用预览

导入屏幕录音

接下来,将用QuickTime Player捕获的屏幕记录文件导入iMovie。 在iMovie:

选择“文件>导入媒体”。 在出现的窗口中,选择屏幕录制文件。

创建一个应用预览项目

要开始一个新的应用程序预览项目,选择文件>新应用程序预览。时间轴将出现,您可以在其中添加和安排剪辑来创建预览。

我很惊讶没有人给我答案。这就是你要做的(如果你有至少一个合格的设备,这将起作用):

用你拥有的设备录制、编辑并完成应用预览。 导出为文件。 打开模拟器,在不同尺寸的iphone上打印屏幕1。 在iMovie中创建一个新的应用预览。 首先插入所需大小的截图,然后添加你已经制作的应用预览文件。 使用共享导出->应用预览 对于新的尺寸,重复步骤4到6。

你应该能够得到你的应用程序预览在所需的分辨率。