Video is not capturing in Landscape mode while running appium script in iPad

Appium script is running in LANDSCAPE mode in iPad but Video is capturing in PORTRAIT mode. Can you please let me know how to capture video in Landscape mode ? Please find the below code.

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(“automationName”, “XCUITest”);
desiredCapabilities.setCapability(“platformName”, “iOS”);
desiredCapabilities.setCapability(“platformVersion”, version);
desiredCapabilities.setCapability(“deviceName”, deviceName);
desiredCapabilities.setCapability(“udid”, deviceName);
desiredCapabilities.setCapability(“orientation”, “LANDSCAPE”);

Video Recording Code:

((CanRecordScreen) driver.getAppiumDriver()).startRecordingScreen();

String video = ((CanRecordScreen) driver.getAppiumDriver()).stopRecordingScreen();
byte[] decodedVideo = Base64.getMimeDecoder().decode(video);

            Path testVideoDir = Paths.get(properties.getProperty("VideoRecordPath").trim());
            try {
			} catch (IOException e) {
				// TODO Auto-generated catch block
            Path testVideoFile = Paths.get(testVideoDir.toString(), String.format("%s-%d.%s", "test", System.currentTimeMillis(), "mp4"));
            try {
				Files.write(testVideoFile, decodedVideo);
			} catch (IOException e) {
				// TODO Auto-generated catch block
           }catch(Exception e)
1 Like

Hi @poovaraj
I have the same problem. Did you find a fix for it?

It is not fixed but I am rotating video in VLC player after capturing.

Note: Video is also not playing properly.

Rotating it afterwards is also my current solution.

How is it not playing properly? I slowed it down a bit by increasing the frames per second to 20 and changing the videotype to mpeg4.

It is playing video after changing video type and frames per seconds. Is it possible to record directly MPEG4 format ?

This is what I’ve done:

final BaseStartScreenRecordingOptions options = new IOSStartScreenRecordingOptions()
((CanRecordScreen) driver).startRecordingScreen(options);

I am using appium client 6.1.0 version and real iPad device. It is not showing mpeg4 file format in videoType and withFps method.

Reference link :-

The format of the screen capture to be recorded. Available formats: “h264”, “mp4” or “fmp4”. Default is “mp4”. Only works for Simulator.

Which version of appium client are you using ?

Currently the video options don’t have possibility to set video rotation parameter, but ffmpeg itself allows to do it. I’m going to add filter option, so it will be possible to provide transpose option like it is described in

@mykola-mokhnach Thank you !

WebDriver is throwing exception after changing Minutes to Days in withTimeLimit option. Is it possible to configure minimum 2 hours in video recording option ?

Error message:

“Exception in thread “pool-1-thread-1” org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: The timeLimit value must be in range [1, 1800] seconds. The value of ‘86400’ has been passed instead.”


final BaseStartScreenRecordingOptions options = new IOSStartScreenRecordingOptions()
((CanRecordScreen) driver).startRecordingScreen(options);