I'm using Ubuntu 18.04 as host, VirtualBox 6.0.8 - and Ubuntu 18.04 Live CD as guest (so not installed).
I'm trying to use the built-in recording facility of VirtualBox 6.0.8 (Machine/Display/Recording) - and it works great, except - it does not record the mouse pointer on video!
Via #12287 (VBox 4.3.2 Video Capture without cursor) – Oracle VM VirtualBox, I've learned:
I'm not sure if we will change this. The cursor is normally drawn by the host, not the guest. To make it drawn by the guest (and to include the mouse cursor into the video), disable the mouse integration.
I've done a ton of things:
- Try disable mouse integration from the bottom menu - does not really matter, mouse integration icon gets grey when out of the VM window, and gets activated again anyway when I click in the VM guest window so it is focused
- Via https://superuser.com/a/1390258/39752 -> "go to 'Motherboard' tab and in pointing device, choose 'USB Tablet' instead of 'PS/2 Mouse'" - does not work
- Tried installing Guest Additions from CD after booting the live CD image, vs not installing Guest Additions -> neither works
- Via gnome-control-center in VirtualBox Ubuntu live-cd guest? -> In "VirtualBox > Settings > Display" for the guest, tried for "Graphics Controller" both VBoxSVGA and VMSVGA - no change, mouse pointer still not on video capture
Does anyone have any ideas, on how can I get the mouse pointer captured on a VirtualBox video recording of Ubuntu 18.04 live CD guest?
Edit: some more details:
First, to enable bidirectional clipboard, you need Guest additions - here is a relatively easy way to install (note that just running Guest Additions CD image install, in Live CD guest, will not build kernel modules and run the service, so it won't work), via:
- https://superuser.com/questions/1318231/why-doesnt-clipboard-sharing-work-with-ubuntu-18-04-lts-inside-virtualbox-5-1-2
- https://www.linuxuprising.com/2019/01/manual-virtualbox-guest-additions.html
... - in guest terminal:
# below commands need to be typed, all in guest Ubuntu terminal:
# need to enable multiverse; in:
#sudo nano /etc/apt/sources.list
sudo add-apt-repository multiverse
#sudo apt update # no need if used add-apt-repository
sudo apt install virtualbox-guest-x11 virtualbox-guest-utils virtualbox-guest-dkms
sudo VBoxClient --clipboard
With this, I could now copy paste, the output from xinput list
regardless of what I do (I get the same also when I don't install Guest Additions):
ubuntu@ubuntu:~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ VirtualBox mouse integration id=9 [slave pointer (2)]
⎜ ↳ ImExPS/2 Generic Explorer Mouse id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Sleep Button id=7 [slave keyboard (3)]
↳ Video Bus id=8 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
Also I tried this, via How to permanently disable mouse integration in Virtualbox? - Super User - on the host terminal:
# get the VM Name
$ VBoxManage list vms
"Ubuntu 18.04 CD" {XXXXX-....}
$ VBoxManage getextradata "Ubuntu 18.04 CD" GUI/MouseCapturePolicy
No value set!
$ VBoxManage setextradata "Ubuntu 18.04 CD" GUI/MouseCapturePolicy Disabled
$ VBoxManage getextradata "Ubuntu 18.04 CD" GUI/MouseCapturePolicy
Value: Disabled
$ VBoxManage getextradata "Ubuntu 18.04 CD" GUI/MouseCapturePolicy
Value: Disabled
# empty set - restore default
$ VBoxManage setextradata "Ubuntu 18.04 CD" GUI/MouseCapturePolicy
$ VBoxManage getextradata "Ubuntu 18.04 CD" GUI/MouseCapturePolicy
No value set!
None of this worked; and then finally, via this answer in How to permanently disable mouse integration in Virtualbox? - Super User:
Try disabling keyboard auto-capture:
- In the main window press File|Preferences
- Select the "Input" tab
- Uncheck "Autocapture keyboard"
This also disables mouse-autocapture.
Tried it, and still VirtualBox mouse integration
shows in xinput list
, and no mouse pointer is captured on video.
Additionally turning off 3D acceleration does not work either.
Well, I ended up cross-posting this question on the VirtualBox forums here: VirtualBox recording video with mouse pointer of Ubuntu live-cd guest? (#18754), and after that, also posted a bug: Ticket #18754 Cannot capture mouse pointer in video recording of Ubuntu 18.04 LiveCD guest.
Nevertheless, after some looking to X11/Xlib, I think I may have found a workaround, which I have documented here: https://stackoverflow.com/questions/57027755/clearing-x11-window-with-desktop-background-pixels-and-putting-ximage-with-tran
That post refers to a C X11 application, gist: xosd_track_cursor.c (a31e9dff5), which basically looks something like this:
While on this gif, it intentionally shows mouse trails, those can be removed by commenting the macro
MOUSE_TRAIL
(as it is in the linked version of the source) - and in that case, the application only tries to duplicate the current mouse pointer. Obviously, this case is not very interesting to observe on a properly installed system, since it will be hard to tell the difference between the original and the cloned mouse cursor/pointer.However, if this application runs in the background of Ubuntu 18.04 LiveCD guest in VirtualBox - then, it makes the mouse pointer visible in VirtualBox video recordings of this guest! It also seems to work both with and without VirtualBox "Mouse Integration" (it even seems, it performs slightly better with "Mouse Integration" turned on?!). Regardless, if you'd use this application for this purpose, you'd probably want to call it in a loop like this:
... just so the application can restart, in the event it crashes in the middle of a video recording of the guest OS in VirtualBox.