Speeding Up Android Screenshots With MJPEG Servers

June 09, 2026 · 9 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual examination get leisurely through data skill insight.
Differentiating capabilities:
  • Extensive end-to-end automation of QA process
  • Relative analysis of app performance against peer
  • Continuous monitoring of app execution employ synthetic data for higher accessibility of apps
  • Easy-to-use developer friendly platform
cloudtest go
Affordable Existent Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized mobile test executing in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based examination

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

speeding up android screenshots with mjpeg serversspeeding up android screenshots with mjpeg servers

Speeding Up Android Screenshots With MJPEG Servers

Published on
August 21, 2019
Updated on
Published on
March 8, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

Previously on Appium Pro, we saw how to, and moreover how to turn that picture into an MJPEG stream for any use. In this clause, we & # x27; re going to focus on the utility of MJPEG streaming for Android. The sad fact about Android is that the supported method of retrieving screenshots (adb screencap) is very dull. There are ways to fine-tune this bidding to get it faster (for example by using adb exec-out and parsing the raw data from stdout), and this is indeed what Appium does to implement the & quot; get screenshot & quot; command on Android.

Still, even in this best lawsuit scenario, Android screenshots can conduct an average of 0.3 to 0.5 seconds. On my machine, an accelerated emulator was able to yield a screenshot every 0.3 sec, and I & # x27; m using pretty beefy ironware. 0.3 seconds is pretty fast, but may not be fast plenty if the reason you & # x27; re taking screenshots is to perform image analysis, or maybe use Appium & # x27; s feature. If you & # x27; re interacting with an app primarily through screenshots, then 0.3 seconds might be the window within which you need to bump an element!

Luckily, there & # x27; s a faster way, leveraging the mjpegScreenshotUrl we saw antecedently. This potentiality directs Appium to avoid its normal & quot; get screenshot & quot; implementation and alternatively connect to anMJPEGhost which is providing a watercourse of the screenshots. This stream results in a buffer of screenshot images store within Appium itself, so that screenshot retrieval is basically instant, costing you only the clip it takes to make the client shout and parse the image data.

Bottom line: if you care about what & # x27; s bechance on the Android screen from a timing perspective, youneedto use mjpegScreenshotUrl. The only question is, how do you get an MJPEG stream of your Android screen going? There are different methods, but the leisurely method I & # x27; ve found is to use the Screen Stream Over HTTP app. It & # x27; s a complimentary download, and is alsounfastened sourcein event you need to figure out how it works.

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

The screen stream app

Basically, this app let you turn on an MJPEG server hosted by the device itself, present image frames free-base on what & # x27; s happening on the blind. You can configure the app so that it serve this current on any port, and also direct it to serve the stream over WiFi only or besides over early interfaces. Here & # x27; s how I set it up:

Setting up Screen Stream Over HTTP for a real device

  1. Ensure the device is connected to the same WiFi network as your Appium server & # x27; s legion
  2. Download and install the app (expend ADB, or through the Play Store)
  3. Launch the app and grant it permissions
  4. Press the & quot; Start Stream & quot; button
  5. Take note of the URL demonstrate in the app. You will need the host and port prove here to build the mjpegScreenshotUrl
Also Check:

Setting up Screen Stream Over HTTP for an emulator

  1. Download and install the app (I & # x27; ve foundapkpureto be a reliable host for this)
  2. Launch the app, and navigate to the Settings
  3. Uncheckthe box that only allows streaming over WiFi (see image below). This is because the emulator doesn & # x27; t actually connect to WiFi so we need to approach the stream habituate another interface
  4. Press the & quot; Start Stream & quot; push
  5. Take note of the URL shown in the app. You will demand theportshown here to construct the mjpegScreenshotUrl. However, unlike for real device, you willnotuse the host IP provided. Instead, you & # x27; ll forward the port to the local interface on the host machine.
  6. Run adb forward tcp:8080 tcp:8080 to ensure that the stream will be available on the emulator & # x27; s horde machine (and replace 8080 with whatever & # x27; s appropriate if you changed the app & # x27; s default port)
The screen stream app settings

Using the mjpegScreenshotUrl

Once you have the URL from the streaming app, try to load it up in your browser. You should see your screen mirror there! This is unfortunately not incisively what we involve for Appium, since the Screen Stream app embeds the current itself within an iframe. To get the URL of the actual stream, add /stream.mjepg to the host URL. (You can also charge this up in your browser to verify it works).

To ensure Appium uses the images render by this stream, all you have to do is make that URL the value of the mjpegScreenshotUrl capacity! Pretty simple, once the app is installed and running. (Remember, if you & # x27; re apply an emulator, the horde should be localhost, because you forwarded the port on your local machine to the port on the emulator via the adb bidding).

Putting it all together

To showcase the usefulness of this coming, I & # x27; ve reduplicate the timing codification from the previous edition of Appium Pro, so we can get a good scientific comparison between tests thatdon & # x27; tuse the MJPEG server and exam that do. The only difference between the two exam suit is the use of the mjpegScreenshotUrl. Since this is the solitary difference, we & # x27; ll run both tests exactly by calling this one helper function:

public long timeScreenshots (boolean useMjpeg) throws IOException {DesiredCapabilities crest = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` Android ''); caps.setCapability (`` deviceName '', `` Android Emulator ''); caps.setCapability (`` automationName '', `` UiAutomator2 ''); caps.setCapability (`` app '', ANDROID_APP); if (useMjpeg) {caps.setCapability (`` mjpegScreenshotUrl '', `` http: //localhost:8080/stream.mjpeg '');} driver = new AndroidDriver (new URL (`` http: //0.0.0.0:4723/wd/hub ''), detonator); long startTime = System.nanoTime (); for (int i = 0; i< 100; i++) {
        driver.getScreenshotAs(OutputType.FILE);
    }
    long endTime = System.nanoTime();

    long msElapsed = (endTime - startTime) / 1000000;
    return msElapsed;
}

Basically, it attempts to get 100 screenshots in a row, and returns the amount of time taken on average. We can either run the screenshot recovery employ the normal method or the MJPEG server method, as depicted in the examination below:

@ Test public nullity timeScreenshotsWithDefaultBehavior () throws IOException {long msElapsed = timeScreenshots (false); System.out.println (`` 100 screenshots normally: `` + msElapsed + `` ms. On mean `` + msElapsed/100 + `` ms per screenshot '');} @ Test public void timeScreenshotsWithMjpegScreenshotBehavior () throws IOException {long msElapsed = timeScreenshots (true); System.out.println (`` 100 screenshots using mjpeg: `` + msElapsed + `` ms. On average `` + msElapsed/100 + `` ms per screenshot '');}

On my machine, utilise the MJPEG server cut the average screenshot time by more than one-half, from ~350ms to ~150ms per screenshot. Your mileage may vary, depending on a lot of ingredient. But it & # x27; s clear that if you care about shaving off those milliseconds from your screenshot clip, using the mjpegScreenshotUrl will be a outstanding scheme.

Have you done anything cool with this characteristic? Let us know! And meanwhile, you can always check out thefull codification samplefor this article on GitHub.

Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in crafting pursue narratives and market collateral across diverse industries. She excels in collaborating with cross-functional squad to develop innovative message strategies and deliver compelling, authentic, and impactful content that resonates with target hearing and enhances brand legitimacy.

LinkedIn

Speeding Up Android Screenshots With MJPEG Servers

4 Parts

regression intelligence blog
-

Regression Intelligence practical guide for forward-looking exploiter (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guide for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing potentiality

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster development rhythm
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain better visibility into functional and execution issues
reduce mean time
Reduce mean time to identify/resolve during test, QA, and product
evaluate audio, video & qoe
Evaluate sound, video, and content quality of experience (QoE) effortlessly
The trusted pick for global enterprises
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can authorise your business with superior testing capabilities

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build regression test for logical results
gain better visibility into functional & performance issues
Gain better profile into functional and performance issues
reduce mean time
Reduce hateful clip to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and contented quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with faster development round
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain best visibility into functional and execution issues
reduce mean time
Reduce mean time to identify/resolve during test, QA, and product
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free