Capture iOS Simulator video for App Preview Capture iOS Simulator video for App Preview ios ios

Capture iOS Simulator video for App Preview


For Xcode 8.2 or later

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

  1. Run your app on the simulator

  2. Open a terminal

  3. Run the command

    • To take a screenshot

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

      For example:

      xcrun simctl io booted screenshot myScreenshot.png

    • To take a video

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

      For example:

      xcrun simctl io booted recordVideo appVideo.mov

  4. Press ctrl + C to stop recording the video.

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

Xcode 11.2 and later gives extra options.

From Xcode 11.2 Beta Release Notes

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.

You could use additional flags:

xcrun simctl io --helpSet 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.

Now you can take a screenshot in jpeg, with mask (for non-rectangular displays) and some other flags:

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


Using xcrun simctl:

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


Using Screen Capture Player:

Use cmd + shift + 5 and the resize the selection so that the simulator is recorded.


Using QuickTime Player:

You can use QuickTime Player to record the screen.

  • Open QuickTime Player
  • Select File from the menu
  • Select New Screen recording

Now from the Screen Recording window, click on the record button.

It will provide you with an option to record the entire screen or a selected portion of your screen.

You will have to make a selection of your simulator so that only the simulator portion will be recorded.


Apple recommends doing so on an actual device and has a guide on how to do this using QuickTime and iMovie on iOS and OS X:https://developer.apple.com/app-store/app-previews/imovie/Creating-App-Previews-with-iMovie.pdf

Summary:

Capture Screen Recordings with QuickTime Player

  1. Connect your iOS device to your Mac using a Lightning cable.
  2. Open QuickTime Player.
  3. Choose File > New Movie Recording.
  4. In the window that appears, select your iOS device as the Camera and Microphone input source.

Create an App Preview with iMovie

Import Screen Recordings

Next, you import the screen recording files that you captured with QuickTime Player into iMovie.In iMovie:

  1. Choose File > Import Media.
  2. In the window that appears, select the screen recording files.

Create an App Preview Project

To start a new app preview project, choose File > New App Preview. A timeline appears where you can add and arrange clips to create your preview.