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 !