Grabar la pantalla del teléfono(MIR) para presentaciones, charlas, etcétera hacia un ordenador(X11)

Ubuntu-Touch no corre un servidor gráfico X11 para presentar la información en pantalla, sino un servidor de MIR. Se puede grabar la pantalla(en vídeo), de la siguiente manera(y usar el vídeo en presentaciones, charlas, etcétera).

Creamos un script en el teléfono con el nombre cast.sh y el siguiente contenido:

#!/bin/sh
srcIP=`echo $SSH_CLIENT | cut -f1 -d' '`
port=12345
printf "mirscreencast'ing to %s port %s\n" $srcIP $port

# note about --cap-interval / -n and resulting fps (for mplayer):
# --cap-interval 10 -n 6   gives: 6  frames per sec (use fps=6 in myplayer)
# --cap-interval 1  -n 1   gives: 60 frames per sec (use fps=60 in myplayer)
# the later of course with a high cost of launching 60 time per sec
# the application 'mirscreencast' :-(
# and this only due to a bug in 'mirscreencast'; see:
# https://bugs.launchpad.net/mir/+bug/1439549
#
# the bug was fixed with OTA-4 (r23) in June 2015, we do not need the while loop
# anymore, but who know; we keep it for now

### while true; do
###   mirscreencast -m /run/mir_socket --stdout --cap-interval 1 -s 270 480 -n 1 || break
### done | gzip -c | nc $srcIP $port

mirscreencast -m /run/mir_socket --stdout --cap-interval 1 -s 270 480 \
    | gzip -c | nc $srcIP $port

Tenemos que usar la conexión tethering por USB, porque la red inalámbrica no es suficiente para transmitir los datos en masa de la pantalla. También tenemos que iniciar antes en el ordenador otro script que recibe el vídeo, lo llamaremos ~/readScreenCast.sh y usa en este caso la herramienta mplayer para presentar el vídeo:

#!/bin/sh

# read the 'mirscreencast' from the Ubuntu phone's MIR server
# see there 'cast.sh'
#
# co guru@unixarea.de, April 2015

nc -l 12345 | gzip -dc |\
    mplayer -demuxer rawvideo -rawvideo fps=60:w=270:h=480:format=rgba -

Funciona a las mil maravillas.

Última actualización: jueves, 19 de noviembre de 2015, 20:44:29 CET

Last updated