アプリプレビュー用のiOSシミュレータビデオをキャプチャする 質問する

アプリプレビュー用のiOSシミュレータビデオをキャプチャする 質問する

さて、これで、App Store にアプリのビデオ プレビューを送信できるようになりました。Apple によると、iOS8 デバイスで送信する必要があるのですが、OSX 10.10.問題は、さまざまなデバイス (4 インチ、4.7 インチ、5.5 インチ、iPad) をすべて用意する必要があることです。

これに代わる方法はありますか?

シミュレータのビデオをキャプチャしようと考えています。問題は、FullHD100% 解像度で表示すると、デバイスの画面がモニターよりも大きいことです。シミュレータからフル解像度でビデオをキャプチャできるソリューションはありますか?

編集: 多くの人が私が尋ねていない質問に答えているので、言わせてください: - 1 つのデバイス サイズを記録してそれをスケーリングすることは、私が尋ねていることではありません。 - アプリのプレビューを記録する方法は、私が尋ねていることではありません。 - プレビューを実行する方法は、私が尋ねていることではありません。

私が尋ねているのは、シミュレーターのビデオが画面に収まらない場合、100% の解像度で録画できるかどうかです。

ベストアンサー1

Xcode 8.2以降の場合

xcrun simctlシミュレータを制御するコマンドラインユーティリティを使用して、シミュレータのビデオやスクリーンショットを撮ることができます。

  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

作成されたファイルのデフォルトの場所は現在のディレクトリです。

Xcode 11.2 以降では追加のオプションが提供されます。

Xcode 11.2 ベータ版リリースノートより

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これで、マスク (長方形以外のディスプレイ用) とその他のフラグを使用して、でスクリーンショットを撮ることができます。

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

おすすめ記事