Does appium UiAutomator2 mjpeg server always start on port 7810?

It does start on the remote device, but is not exposed to a local port (e.g. port forwarding does not happen):

  async allocateMjpegServerPort () {
    if (this.opts.mjpegServerPort) {
      await this.adb.forwardPort(this.opts.mjpegServerPort, MJPEG_SERVER_DEVICE_PORT);
    }
  }

According to documentation GitHub - appium/appium-uiautomator2-driver: Appium driver for Android UIAutomator2, capability appium:mjpegServerPort is the number of the port UiAutomator2 server starts the MJPEG server on.
If I set capability mjpegServerPort to a custom port 12345, the UiAutomator2 mjpeg server still starts on port 7810. How can I set a custom port?

The documentation is probably not very clear there. The idea is to consume the stream from localhost. That is why mjpegServerPort capability does the port forwarding. Which means you should not change any settings, it is just enough to set a valid value to the capability above and start consuming the stream from http://localhost:$mjpegServerPort