6

I am trying to record the screen of my iOS 11.4 simulator with xcrun simctl io booted recordVideo recording.mov. This creates a file with that name, but unfortunately that file always has the size of 0 byte. Playing around with the --type parameter did not help either. Occasionally there was a playable file, which also was corrupted to a degree, as this file had a distorted look to it when opened in QuickTime. VLC could not play it at all.

I am using Xcode 9.4.1 on a 2014 MacBook Pro with discrete GPU, so Metal is supported.

Does anyone have suggestions to solve my problem?

NKO
  • 63
  • 4

3 Answers3

4

There was a timing bug in video recording that could result in 0-byte files on some systems. I'm sorry, but there is unfortunately no workaround. This should be addressed with changes in Xcode 10 Beta 3+.

Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
  • 1
    Indeed it's failing for me in Xcode 9.4.1 and Xcode 10 Beta 2, but I just tried Xcode Beta 4 and it worked, although the video produced had some strange glitches as if the image was melting :( – endavid Jul 27 '18 at 21:21
2

I had that same issue and was scratching my head over that for days. The fix turns out to be simple though. Make sure you press Control + C and quit the simulator. Once you quit the simulator it starts to actually produce the recording.

Harish
  • 1,374
  • 17
  • 39
1

You have to specify the device you want to record, and "booted" isn't valid.

Run this to see what's booted:

xcrun simctl list | grep Booted

In my case I see:

iPhone X (D3DB2489-B630-42AB-A615-A2F07F6F6876) (Booted)

To record this device:

xcrun simctl io D3DB2489-B630-42AB-A615-A2F07F6F6876 recordVideo ~/simrecord.mov

Here's example output from my terminal:

[ ~] xcrun simctl list | grep Booted
    iPhone X (D3DB2489-B630-42AB-A615-A2F07F6F6876) (Booted)
[ ~] xcrun simctl io D3DB2489-B630-42AB-A615-A2F07F6F6876 recordVideo ~/simrecord.mov
GVA encoder info: recomputed for fps: 11.353266, gop size in pics: 340, gop size in sec: 30.000000 
Recording... (Press CTRL+C to stop)
^C
Recording completed.
[ ~] ls -lrt | tail -1
-rw-r--r--    1 shawd  staff  32933285 Jun 29 16:34 simrecord.mov

One other thing to mention is that you can also record the simulator with Quicktime on the Mac pretty easily. That's what most people do.

David S.
  • 6,567
  • 1
  • 25
  • 45
  • 2
    Thank you for your suggestion, but unfortunately this does give me the same 0 byte sized file. – NKO Jun 29 '18 at 07:03
  • You know you have to stop the recording before the file is written, yes? Updated my answer with terminal output. – David S. Jun 29 '18 at 20:35