An Ubuntu phone has a command-line utility called
mirscreencast which dumps screen frames to a file, meaning that in theory it’s possible to record a video of your phone’s screen. In practice, though, it doesn’t work for video; the phone is that busy (a) grabbing frames and (b) writing them to the phone’s storage that you can’t actually use it for jerkiness, and the resultant video includes about one frame in ten. I can’t fix this, but I did come up with a way to make it at least a bit better — instead of saving the video onto the phone’s storage, send it over the network to a real machine.
On your computer:
nc -l -p 1234 > out, which uses netcat to listen to port 1234 and send everything that comes in there to a file named
On the phone:
mirscreencast -n 600 -m /var/run/mir_socket -s 360 640 --stdout | nc mycomputer 1234, which uses
mirscreencast to record frames (at a particular smaller size) and then send them with netcat to port 1234 on the computer. (You may need to put your computer’s IP address instead of mycomputer, especially since Ubuntu phone won’t resolve computername.local names.)
Then, once recording finishes,
mencoder -demuxer rawvideo -rawvideo fps=6:w=360:h=640:format=bgra -ovc x264 -o out.mp4 out makes a proper mp4. (Cheers Bill for the
It still isn’t great. But it’s a bit better.
-s option to shrink the size and
--cap-interval option to only grab some frames seems to work even better. A command like
mirscreencast -n 60 -m /var/run/mir_socket --stdout --cap-interval 4 -s 384 640 will record 1/4 of the frames (
--cap-interval 4), which is 15fps (rather than the screen’s 60fps), and resize those frames to half their size (my Nexus 4 has a screen resolution of 768x1280, which halved is 384x640, and each frame is only a quarter of the size). Converting like so:
mencoder -demuxer rawvideo -rawvideo fps=15:w=384:h=640:format=rgba -ovc x264 -o out.mp4 out (note the
h for screen size, and
fps=15) and you get pretty much perfectly smooth video.