Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to render recording locally using "maestro record --local" #2173

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

Leland-Takamine
Copy link
Contributor

@Leland-Takamine Leland-Takamine commented Dec 5, 2024

Uses Jetbrain's Skiko to render video locally. Skiko is a Kotlin library that provides bindings to Skia which is the rendering engine for Google Chrome and ChromeOS, Android, Flutter, and others.

Why Skia?

  • It is a battle-tested piece of software (Google Chrome and ChromeOS, Android, Flutter)
  • It can run on Mac, Linux, or Windows and x86 + ARM
  • There is a well-maintained JVM bindings library (Skiko)
  • It doesn't require anything additional to be installed by users
  • It has modern rendering capabilities like shadows and color emoji rendering
  • It can run headless (without a browser or display)

The other alternatives I looked into fell short in one way or another (eg. AWT, JavaFX). Skia checked all the boxes.

Example of locally rendered video:

maestro-recording.mp4

outputFile = localOutputFile,
outputFPS = 25,
outputWidthPx = 1920,
outputHeightPx = 1080,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these the same specs for the video we used to record with remote renderer?

Copy link
Contributor Author

@Leland-Takamine Leland-Takamine Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remote recorder was 30 fps but I think 25 if sufficient. Same resolution

import java.awt.image.BufferedImage
import javax.imageio.ImageIO

class SkiaFrameRenderer : FrameRenderer {
Copy link
Collaborator

@amanjeetsingh150 amanjeetsingh150 Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking about what would be the best way to get this from beta to prod (stable):

  1. Recommending to use this to everyone who raised a Github issue for the remote renderer
  2. Announcing this in the contributor's lounge or just the announcement channel to see if it works for everyone.

WDYT?

Copy link
Contributor Author

@Leland-Takamine Leland-Takamine Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think we can announce in slack and have folks try it out. Lots of users have asked for this

Comment on lines +52 to +57
// !! Due to smart cast limitation: https://youtrack.jetbrains.com/issue/KT-7186
@Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
while (nextFrame != null && nextFrame!!.timestamp <= currentTimestampSeconds) {
curFrame = nextFrame!!
nextFrame = grab.nativeFrameWithMetadata
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this bug is fixed in Kotlin 2.0

(currently Maestro is at 1.8.22)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice good to know!

@Leland-Takamine Leland-Takamine merged commit fa9588d into main Dec 10, 2024
8 checks passed
@Leland-Takamine Leland-Takamine deleted the local-record-rendering branch December 10, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants