Does appium UiAutomator2 mjpeg server work on Android 5?

The answer is yes. Appium UiAutomator2 mjpeg server works on Android 5.

Thanks to mykola-mokhnach for the explanation in Does appium UiAutomator2 mjpeg server always start on port 7810?.
Capability mjpegServerPort specifies the PC port instead of the Android port.
The UiAutomator2 mjpeg server always starts on Android port 7810.
In below Python code, mjpegServerPort is set to 12345, which causes Android port 7810 forwarded to PC port 12345.

from appium import webdriver
from datetime import datetime
deviceName = 'm4'
caps = dict(
            platformName = 'Android',
            automationName = 'uiautomator2',
            udid = deviceName + ':5555',
            mjpegServerPort = 12345,
            mjpegScreenshotUrl = 'http://localhost:12345',
            newCommandTimeout = 600,
            noReset = True
        )
driver = webdriver.Remote('http://localhost:4723/wd/hub', caps)

The appium server log should contains

[debug] [ADB] Forwarding system: 12345 to device: 7810

One difference below Android 5 and Android >= 6 is Android port 7810 is not exposed on Android 5. That means,
For Android 5, mjpegScreenshotUrl should be set to http://localhost:12345.
For Android >= 6, mjpegScreenshotUrl can be set to http://localhost:12345 or http://m4:7810, where m4 is the hostname of my Andriod phone.