iOS - ffmpeg died unexpectedly

I’m trying to screen record on a simulator but I get the following error:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: The screen capture process 'ffmpeg' died unexpectedly. Check server logs for more details.

Any ideas would be greatly appreciated.

  • Appium version: 1.22.2
  • Desktop OS/version used to run Appium: OSX Monterey 12.2.1
  • Node.js version: 17.5.0
  • Npm package manager: 8.4.1
  • Mobile platform/version under test: iOS 12.2
  • Appium CLI or Appium.app|exe: CLI
  • FFMPEG version: 5.0
  • Running on simulator iOS 15.2 / iPhone 13
  • Xcode: 13.2.1
[debug] e[35m[WD Proxy]e[39m Got response with status 200: {"value":
{"boundElementsByIndex":false,"mjpegServerFramerate":10,"screenshotOrientation":"auto","reduceMotion":false,"elementResponseAttributes":"type,label","screenshotQuality":1,"mjpegScalingFactor":100,"keyboardPrediction":0,"defaultActiveApplication":"auto","mjpegServerScreenshotQuality":25,"defaultAlertAction":"accept","keyboardAutocorrection":0,"useFirstMatch":false,"shouldUseCompactResponses":true,"customSnapshotTimeout":15,"dismissAlertButtonSelector":"","activeAppDetectionPoint":"64.00,64.00","snapshotMaxDepth":50,"waitForIdleTimeout":10,"includeNonModalElements":false,"acceptAlertButtonSelector":"","animationCoolOffTimeout":2},"sessionId":"83CF61D3-58C7-4D61-AB1B-E3D08328569D"}
[info] e[35m[DevCon Factory]e[39m Requesting connection for device 3A22DC42-5828-4693-B05C-91D7169011FC on local port 9100, device port 9100
[debug] e[35m[DevCon Factory]e[39m Cached connections count: 1
[info] e[35m[DevCon Factory]e[39m Successfully requested the connection for 3A22DC42-5828-4693-B05C-91D7169011FC:9100
[info] e[35m[ffmpeg]e[39m ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
[info] e[35m[ffmpeg]e[39m   built with Apple clang version 13.0.0 (clang-1300.0.29.3)
[info] e[35m[ffmpeg]e[39m   configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
[info] e[35m[ffmpeg]e[39m   libavutil      57. 17.100 / 57. 17.100
[info] e[35m[ffmpeg]e[39m   libavcodec     59. 18.100 / 59. 18.100
[info] e[35m[ffmpeg]e[39m   libavformat    59. 16.100 / 59. 16.100
[info] e[35m[ffmpeg]e[39m   libavdevice    59.  4.100 / 59.  4.100
[info] e[35m[ffmpeg]e[39m   libavfilter     8. 24.100 /  8. 24.100
[info] e[35m[ffmpeg]e[39m   libswscale      6.  4.100 /  6.  4.100
[info] e[35m[ffmpeg]e[39m   libswresample   4.  3.100 /  4.  3.100
[info] e[35m[ffmpeg]e[39m   libpostproc    56.  3.100 / 56.  3.100
[info] e[35m[ffmpeg]e[39m 
[info] e[35m[ffmpeg]e[39m [http @ 0x7f8c67105780] HTTP error 426 Upgrade Required
[info] e[35m[ffmpeg]e[39m http://127.0.0.1:9100: Server returned 4XX Client Error, but not one of 40{0,1,3,4}
[info] e[35m[ffmpeg]e[39m [error] e[35m[Xcode]e[39m     t =     4.46s Get all elements bound by accessibility element for: Elements matching predicate 'elementType IN {7, 5, 46}'
[error] e[35m[Xcode]e[39m 
[error] e[35m[Xcode]e[39m     t =     4.46s     Requesting snapshot of accessibility hierarchy for app with pid 26455
[error] e[35m[Xcode]e[39m 
[error] e[35m[Xcode]e[39m     t =     4.53s     Find: Descendants matching type Any
[error] e[35m[Xcode]e[39m 
[error] e[35m[Xcode]e[39m     t =     4.53s     Find: Elements matching predicate 'elementType IN {7, 5, 46}'
[error] e[35m[Xcode]e[39m [error] e[35m[Xcode]e[39m     t =     6.59s Get all elements bound by accessibility element for: Elements matching predicate 'elementType IN {7, 5, 46}'
[error] e[35m[Xcode]e[39m 
[error] e[35m[Xcode]e[39m     t =     6.59s     Requesting snapshot of accessibility hierarchy for app with pid 26455
[error] e[35m[Xcode]e[39m [error] e[35m[Xcode]e[39m     t =     6.65s     Find: Descendants matching type Any
[error] e[35m[Xcode]e[39m 
[error] e[35m[Xcode]e[39m     t =     6.65s     Find: Elements matching predicate 'elementType IN {7, 5, 46}'
[error] e[35m[Xcode]e[39m [warn] e[35m[XCUITest]e[39m Screen capture process did not start within 5000ms. Continuing anyway
[info] e[35m[DevCon Factory]e[39m Releasing connections for 3A22DC42-5828-4693-B05C-91D7169011FC device on 9100 port number
[info] e[35m[DevCon Factory]e[39m Found cached connections to release: ["3A22DC42-5828-4693-B05C-91D7169011FC:9100"]
[debug] e[35m[DevCon Factory]e[39m Cached connections count: 1
[debug] e[35m[W3C (260f54ef)]e[39m Encountered internal error running command: Error: The screen capture process 'ffmpeg' died unexpectedly. Check server logs for more details
[debug] e[35m[W3C (260f54ef)]e[39m     at ScreenRecorder.start (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/recordscreen.js:114:13)
[info] e[35m[HTTP]e[39m e[37m<-- POST /wd/hub/session/260f54ef-8d24-42d2-a2fa-9b84ba5a1671/appium/start_recording_screen e[39me[31m500e[39m e[90m5024 ms - 763e[39m
[info] e[35m[HTTP]e[39m e[90me[39m
[info] e[35m[HTTP]e[39m e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/session/260f54ef-8d24-42d2-a2fa-9b84ba5a1671/appium/stop_recording_screene[39m
[info] e[35m[HTTP]e[39m e[90m{}e[39m
[debug] e[35m[W3C (260f54ef)]e[39m Calling AppiumDriver.stopRecordingScreen() with args: [null,"260f54ef-8d24-42d2-a2fa-9b84ba5a1671"]
[debug] e[35m[XCUITest]e[39m Executing command 'stopRecordingScreen'
[info] e[35m[XCUITest]e[39m Screen recording is not running. There is nothing to stop.
[debug] e[35m[W3C (260f54ef)]e[39m Responding to client with driver.stopRecordingScreen() result: ""
[info] e[35m[HTTP]e[39m e[37m<-- POST /wd/hub/session/260f54ef-8d24-42d2-a2fa-9b84ba5a1671/appium/stop_recording_screen e[39me[32m200e[39m e[90m1 ms - 12e[39m
[info] e[35m[HTTP]e[39m e[90me[39m
[info] e[35m[HTTP]e[39m e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/session/260f54ef-8d24-42d2-a2fa-9b84ba5a1671/appium/app/closee[39m
[info] e[35m[HTTP]e[39m e[90m{}e[39m
[debug] e[35m[W3C (260f54ef)]e[39m Calling AppiumDriver.closeApp() with args: ["260f54ef-8d24-42d2-a2fa-9b84ba5a1671"]
[debug] e[35m[XCUITest]e[39m Executing command 'closeApp'

You shouldn’t use the GUI as a CLI. It’s not meant for this. Install via Node or you can download the source from github. Here is a tutorial on setting up CLI:

https://appium.io/docs/en/about-appium/getting-started/index.html

I set up the CLI and removed the GUI properly but still get the same Error: The screen capture process 'ffmpeg' died unexpectedly after running tests.

My code:

    private fun startScreenRecording() {
        driver.startRecordingScreen(
            IOSStartScreenRecordingOptions()
                .withVideoType("mpeg4")
                .withVideoScale("iw/2:ih/2")
                .withTimeLimit(Duration.ofSeconds(100))
        )
    }

Full error:

     org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: The screen capture process 'ffmpeg' died unexpectedly. Check server logs for more details
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Miguels-MBP.lan1', ip: {*ip-excluded-for-privacy*}, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_322'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {app: /Users/{*user-excluded-for-privacy*}/Project..., autoAcceptAlerts: true, autoDismissAlerts: true, browserName: , databaseEnabled: false, deviceName: iPhone 13, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 300000, platform: MAC, platformName: IOS, platformVersion: 15.2, processArguments: {args: [-mockLocalAuth, YES, -customIsMocking, YES, -kHasOnboardedKey, YES]}, takesScreenshot: true, udid: 3A22DC42-5828-4693-B05C-91D..., wdaLaunchTimeout: 300000, webStorageEnabled: false}
Session ID: 1958faa3-9e63-47db-b60c-03813be6a7bb
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
        at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
        at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:247)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
        at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
        at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
        at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
        at io.appium.java_client.CommandExecutionHelper.execute(CommandExecutionHelper.java:27)
        at io.appium.java_client.screenrecording.CanRecordScreen.startRecordingScreen(CanRecordScreen.java:39)
        at helpers.Appium.startScreenRecording(Appium.kt:82)
        at helpers.Appium.setUp(Appium.kt:78)

Relevant server log snippet:

[WebDriverAgent] Using provided WebdriverAgent at 'http://127.0.0.1:8100/'
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"15.2","version":"15.2"},"ios":{"simulatorVersion":"15.2","ip":"192.168.1.213"},"ready":true,"build":{"upgradedAt":"1644981468142","time":"Feb 15 2022 21:29:46","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":"10B90975-D6BC-470E-93E4-DF17493BE905"}
[debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1644987919325 (23:05:19 GMT-0600 (Central Standard Time))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [WD Proxy] Matched '/session' to command name 'createSession'
[debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"bundleId":"XXXX","arguments":["-mockLocalAuth","YES","-customIsMocking","YES","-kHasOnboardedKey","YES"],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true,"forceAppLaunch":true,"useNativeCachingStrategy":true,"forceSimulatorSoftwareKeyboardPresence":true,"defaultAlertAction":"accept"}],"alwaysMatch":{}}}
[debug] [WD Proxy] Got response with status 200: {"value":{"sessionId":"C6C977D7-9298-460A-A976-5EE796BBA87D","capabilities":{"device":"iphone","browserName":"XXXX_REMOTE_DISPLAY_NAME","sdkVersion":"15.2","CFBundleIdentifier":"XXXXX"}},"sessionId":"C6C977D7-9298-460A-A976-5EE796BBA87D"}
[WD Proxy] Determined the downstream protocol as 'W3C'
[debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1644987921441 (23:05:21 GMT-0600 (Central Standard Time))
[debug] [BaseDriver] Event 'wdaStarted' logged at 1644987921441 (23:05:21 GMT-0600 (Central Standard Time))
[XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
[debug] [BaseDriver] Event 'orientationSet' logged at 1644987921441 (23:05:21 GMT-0600 (Central Standard Time))
[debug] [BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[debug] [BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[Appium] New XCUITestDriver session created successfully, session 1958faa3-9e63-47db-b60c-03813be6a7bb added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1644987921442 (23:05:21 GMT-0600 (Central Standard Time))
[debug] [W3C (1958faa3)] Cached the protocol value 'W3C' for the new session 1958faa3-9e63-47db-b60c-03813be6a7bb
[debug] [W3C (1958faa3)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","app":"/Users/miguelfraire/Projects/XXXX-mobile-ios/RegressionTests/../derivedData/Build/Products/Debug-iphonesimulator/RemoteFlavor.app","autoAcceptAlerts":true,"autoDismissAlerts":true,"deviceName":"iPhone 13","newCommandTimeout":300000,"platformVersion":"15.2","processArguments":{"args":["-mockLocalAuth","YES","-customIsMocking","YES","-kHasOnboardedKey","YES"]},"wdaLaunchTimeout":300000,"udid":"3A22DC42-5828-4693-B05C-91D7169011FC"}}
[HTTP] <-- POST /wd/hub/session 200 5830 ms - 738
[HTTP] 
[HTTP] --> POST /wd/hub/session/1958faa3-9e63-47db-b60c-03813be6a7bb/timeouts
[HTTP] {"implicit":10000}
[debug] [W3C (1958faa3)] Calling AppiumDriver.timeouts() with args: [null,null,null,null,10000,"1958faa3-9e63-47db-b60c-03813be6a7bb"]
[debug] [XCUITest] Executing command 'timeouts'
[debug] [BaseDriver] W3C timeout argument: {"implicit":10000}}
[debug] [BaseDriver] Set implicit wait to 10000ms
[debug] [W3C (1958faa3)] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/1958faa3-9e63-47db-b60c-03813be6a7bb/timeouts 200 3 ms - 14
[HTTP] 
[HTTP] --> POST /wd/hub/session/1958faa3-9e63-47db-b60c-03813be6a7bb/appium/start_recording_screen
[HTTP] {"options":{"timeLimit":100,"videoType":"mpeg4","videoScale":"iw/2:ih/2"}}
[debug] [W3C (1958faa3)] Calling AppiumDriver.startRecordingScreen() with args: [{"timeLimit":100,"videoType":"mpeg4","videoScale":"iw/2:ih/2"},"1958faa3-9e63-47db-b60c-03813be6a7bb"]
[debug] [XCUITest] Executing command 'startRecordingScreen'
[XCUITest] Checking if there is/was a previous screen recording. Set 'forceRestart' option to 'true' if youd like to skip this step.
[XCUITest] Screen recording is not running. There is nothing to stop.
[DevCon Factory] Releasing connections for 3A22DC42-5828-4693-B05C-91D7169011FC device on 9100 port number
[DevCon Factory] No cached connections have been found
[debug] [WD Proxy] Matched '/appium/settings' to command name 'getSettings'
[debug] [WD Proxy] Proxying [GET /appium/settings] to [GET http://127.0.0.1:8100/session/C6C977D7-9298-460A-A976-5EE796BBA87D/appium/settings] with no body
[debug] [WD Proxy] Got response with status 200: {"value":{"boundElementsByIndex":false,"mjpegServerFramerate":10,"screenshotOrientation":"auto","reduceMotion":false,"elementResponseAttributes":"type,label","screenshotQuality":1,"mjpegScalingFactor":100,"keyboardPrediction":0,"defaultActiveApplication":"auto","mjpegServerScreenshotQuality":25,"defaultAlertAction":"accept","keyboardAutocorrection":0,"useFirstMatch":false,"shouldUseCompactResponses":true,"customSnapshotTimeout":15,"dismissAlertButtonSelector":"","activeAppDetectionPoint":"64.00,64.00","snapshotMaxDepth":50,"waitForIdleTimeout":10,"includeNonModalElements":false,"acceptAlertButtonSelector":"","animationCoolOffTimeout":2},"sessionId":"C6C977D7-9298-460A-A976-5EE796BBA87D"}
[DevCon Factory] Requesting connection for device 3A22DC42-5828-4693-B05C-91D7169011FC on local port 9100, device port 9100
[debug] [DevCon Factory] Cached connections count: 1
[DevCon Factory] Successfully requested the connection for 3A22DC42-5828-4693-B05C-91D7169011FC:9100
[ffmpeg] ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
[ffmpeg]   built with Apple clang version 13.0.0 (clang-1300.0.29.30)
[ffmpeg]   configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
[ffmpeg]   libavutil      57. 17.100 / 57. 17.100
[ffmpeg]   libavcodec     59. 18.100 / 59. 18.100
[ffmpeg]   libavformat    59. 16.100 / 59. 16.100
[ffmpeg]   libavdevice    59.  4.100 / 59.  4.100
[ffmpeg]   libavfilter     8. 24.100 /  8. 24.100
[ffmpeg]   libswscale      6.  4.100 /  6.  4.100
[ffmpeg] 
[ffmpeg]   libswresample   4.  3.100 /  4.  3.100
[ffmpeg]   libpostproc    56.  3.100 / 56.  3.100
[ffmpeg] 
[ffmpeg] [http @ 0x7f78c7204fc0] HTTP error 426 Upgrade Required
[ffmpeg] 
[ffmpeg] http://127.0.0.1:9100: Server returned 4XX Client Error, but not one of 40{0,1,3,4}
[ffmpeg] 
[XCUITest] Screen capture process did not start within 5000ms. Continuing anyway
[DevCon Factory] Releasing connections for 3A22DC42-5828-4693-B05C-91D7169011FC device on 9100 port number
[DevCon Factory] Found cached connections to release: ["3A22DC42-5828-4693-B05C-91D7169011FC:9100"]
[debug] [DevCon Factory] Cached connections count: 1
[debug] [W3C (1958faa3)] Encountered internal error running command: Error: The screen capture process 'ffmpeg' died unexpectedly. Check server logs for more details
[debug] [W3C (1958faa3)]     at ScreenRecorder.start (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/recordscreen.js:114:13)
[debug] [W3C (1958faa3)]     at XCUITestDriver.startRecordingScreen (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/recordscreen.js:296:5)
[HTTP] <-- POST /wd/hub/session/1958faa3-9e63-47db-b60c-03813be6a7bb/appium/start_recording_screen 500 5046 ms - 675
[HTTP] 
[HTTP] --> POST /wd/hub/session/1958faa3-9e63-47db-b60c-03813be6a7bb/appium/stop_recording_screen
[HTTP] {}
[debug] [W3C (1958faa3)] Calling AppiumDriver.stopRecordingScreen() with args: [null,"1958faa3-9e63-47db-b60c-03813be6a7bb"]
[debug] [XCUITest] Executing command 'stopRecordingScreen'
[XCUITest] Screen recording is not running. There is nothing to stop.
[debug] [W3C (1958faa3)] Responding to client with driver.stopRecordingScreen() result: ""

This part stands out to me:

[ffmpeg] [http @ 0x7f78c7204fc0] HTTP error 426 Upgrade Required
[ffmpeg]
[ffmpeg] http://127.0.0.1:9100: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

And that the port numbers are different:

[WebDriverAgent] Using provided WebdriverAgent at ‘http://127.0.0.1:8100/

[DevCon Factory] Requesting connection for device 3A22DC42-5828-4693-B05C-91D7169011FC on local port 9100, device port 9100

try =>

((IOSDriver) driver).startRecordingScreen(
                    new IOSStartScreenRecordingOptions()
                            .withFps(24)
                            .withVideoScale("320:-2")
                            .withVideoType("h264") // mpeg4 / h264
                            .withTimeLimit(Duration.ofMinutes(10)));

mine ffmpeg version 4.4

Same error as before. I did look up ffmpeg yesterday and I think 5.0 is the latest. I wonder if upgrade refers to the Xcode version?

No idea if that matters. However, this could give more info:

Looks like you can have ffmpeg create a log by setting an environment variable FFREPORT:

Can’t say these logs point out something glaringly intuitive

ffmpeg started on 2022-02-16 at 12:09:51
Report written to “./Failures/log/ffmpeg-2022021645034365.log”
Log level: 48
Command line:
ffmpeg -f mjpeg -i http://127.0.0.1:9100 -vf “scale=iw/2:ih/2” -vcodec mpeg4 -y /var/folders/17/4pfc9z9d1h17g2wkkx8382l00000gn/T/2022116-11269-hqgqal.wf91f/appium_d420b8.mp4
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 13.0.0 (clang-1300.0.29.30)
configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Splitting the commandline.
Reading option ‘-f’ … matched as option ‘f’ (force format) with argument ‘mjpeg’.
Reading option ‘-i’ … matched as input url with argument ‘http://127.0.0.1:9100’.
Reading option ‘-vf’ … matched as option ‘vf’ (set video filters) with argument ‘scale=iw/2:ih/2’.
Reading option ‘-vcodec’ … matched as option ‘vcodec’ (force video codec (‘copy’ to copy stream)) with argument ‘mpeg4’.
Reading option ‘-y’ … matched as option ‘y’ (overwrite output files) with argument ‘1’.
Reading option ‘/var/folders/17/4pfc9z9d1h17g2wkkx8382l00000gn/T/2022116-11269-hqgqal.wf91f/appium_d420b8.mp4’ … matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url http://127.0.0.1:9100.
Applying option f (force format) with argument mjpeg.
Successfully parsed a group of options.
Opening an input file: http://127.0.0.1:9100.
[mjpeg @ 0x7fc08b805700] Opening ‘http://127.0.0.1:9100’ for reading
[http @ 0x7fc08b805980] Setting default whitelist ‘http,https,tls,rtp,tcp,udp,crypto,httpproxy,data’
[tcp @ 0x7fc08b904080] Original list of addresses:
[tcp @ 0x7fc08b904080] Address 127.0.0.1 port 9100
[tcp @ 0x7fc08b904080] Interleaved list of addresses:
[tcp @ 0x7fc08b904080] Address 127.0.0.1 port 9100
[tcp @ 0x7fc08b904080] Starting connection attempt to 127.0.0.1 port 9100
[tcp @ 0x7fc08b904080] Successfully connected to 127.0.0.1 port 9100
[http @ 0x7fc08b805980] request: GET / HTTP/1.1
User-Agent: Lavf/59.16.100
Accept: /
Range: bytes=0-
Connection: close
Host: 127.0.0.1:9100
Icy-MetaData: 1
[http @ 0x7fc08b805980] HTTP error 426 Upgrade Required
http://127.0.0.1:9100: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

I think you should file a bug here:

Things to try:

  1. You might try a different simulator, maybe with a different iOS version
  2. You might try downgrading to 4.4 as @Aleksei suggests