Saturday, February 14, 2009

Oasis y Travis en concierto

Las fotos las hice en ambos conciertos con el android G1, la calidad deja bastante que desear, también mi pulso con una cerveza en la mano no es muy fino ;-)

http://www.youtube.com/watch?v=BseffSA3eTA

Veamos que lal funciona publicar en blogger desde Android.

Sunday, February 01, 2009

How to stream media and TV to your Android G1

The first thing I had in mind when I got the T-mobile G1 was to try a kind of TV streaming to the phone, just in case I have to travel to other countries, for example Sweden, and I would like to hear some Spanish voices :-).

At the end what really you can achieve is a full streaming server with support to stream your music files, videos and of course your dvb-t or dvb-s channels
Another important point for the project was to use open software as much as possible.

So lets go, and I'll explain how I did it:



Main components used:

-Ubuntu Hardy 8.04
-Capture card: Hauppage HVR-4000
-ffmpeg
-x264
-VLC
-Darwin Streaming Server

First thing's first, we will need to compile manually almost all the components to add the necessary features that we want.
We must know also that our beloved phone support some codecs and file containers, as said here, G1 by now doesn't let as port codec library onto it and Adobe says they'll publish flash player 10 for mobile on 2009.

Screen:
3.2-inch TFT-LCD flat touch-sensitive screen with 320 x 480 (HVGA) resolution

Codec:
H.264/AVC
H.263/MPEG4 Part-2
WMV/8 (9 is not playable)
AAC/mp4a/AMR/mp3/wave/wma8 audio

Supported File Container:
.mp4
.3gp

Knowing the requirements lets prepare the server machine for that.
We have to compile the latest ffmpeg and x264 from source, for that you should follow the explanations from:
http://ubuntuforums.org/showthread.php?t=786095

Once finished the installation of ffmpeg, now move to install the latest vlc possible following this guide:

Before building vlc we need the rtsp support that arrive to us thanks to live555, again here we have to compile the sources. To do so follow the tips in:
http://www.live555.com/liveMedia/#config-unix

After that, I built vlc with the next configuration command:

../configure --prefix=/usr --enable-snapshot --enable-debug --enable-dbus-control --enable-musicbrainz --enable-shared-libvlc --enable-mozilla --enable-lirc --enable-x264 --with-x264-tree=/you/path/x264 --enable-shout --enable-taglib --enable-v4l --disable-xvmc --enable-svg --enable-dvdread --enable-dc1394 --enable-dv --enable-twolame --enable-real --enable-flac --enable-tremor --enable-skins2 --enable-qt4 --enable-ncurses --enable-aa --enable-caca --enable-esd --disable-portaudio --enable-jack --enable-xosd --enable-galaktos --enable-goom --enable-ggi --disable-cddax --disable-vcdx --disable-quicktime --enable-lua --enable-sdl --enable-ffmpeg --with-ffmpeg-mp3lame --enable-mad --enable-libdvbpsi --enable-a52 --enable-libmpeg2 --enable-dvdnav --enable-mp4 --enable-faad --enable-vorbis --enable-ogg --enable-theora --enable-x11 --enable-xvideo --enable-dvb --enable-pp --enable-realrtsp --enable-live555 --with-live555-tree=/home/dani/live --enable-faac --enable-mkv --enable-freetype --enable-fribidi --enable-speex --enable-flac --enable-x11 --enable-xvideo --enable-dvb --enable-pp --with-ffmpeg-tree=/your/path/ffmpeg --disable-zvbi --disable-swscale

and using the guide:
http://www.jbkempf.com/blog/post/2008/03/28/Build-VLC-media-player-under-Ubuntu-Hardy-804

If you find problems during make of vlc regarding libdvb read the next link
http://freshmeat.net/projects/libdvbpsi/
If you find any other issues during vlc set-up, read the comments on the above guide, read the output in the screen, copy and paste it in google and look for the solution. Usually this compilations complain about dependencies dev library's that also needs to be installed. Nothing from another world if you use Linux.

Where are we know?, at this point your system is able to convert videos for watching in your G1, so if you feel tired you can rest a bit by trying to convert an avi file to mp4 and pass it to your SD card to see the quality. You will need to install a video player from Android Market.
So try to do a:

ffmpeg -i source-video.avi -s 480x320 -vcodec mpeg4 -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2 output-video.G1.mp4

If you want more information about the parameters in that line you can read:
http://androidcommunity.com/forums/showthread.php?p=88879#post88879

Now we are able to do a lot of types of streaming thanks to VLC, but we miss the important one, stream a mp4 container over rtp to be received via rtsp in the G1 client. As we can see in the Output method/muxer matrix table from VLC features

For doing that we are going to rely on Darwin Streaming Server, that is the open source version of Apple's QuickTime Streaming Server technology that allows you to send streaming media to clients across the Internet using the industry standard RTP and RTSP protocols.
We have to install it in our system, I followed a spanish guide for that, but I'm sure that it is possible to find a lot of guides over the internet for this purpose, so choose the one that you like.

After the installation we have to configure it, in my case I only set up the IP address of the server and checked the ports on the configuration file:

/etc/streaming/streamingserver.xml

http://wiki.dlib.indiana.edu/confluence/display/V3/Darwin+Streaming+Server

After the configuration it is a good idea to kill the server (DarwinStreamingServer) and run it again in order to pick up the changes.
At this point you can put your converted mp4 videos into the /usr/local/movies and access them via rtsp://yourserver:yourport/yourfile.mp4
Take into account that for some reason ffmpeg doesn't prepare the mp4 file to use it directly with Darwin, and you will have to prepare (hint) the file before being accesible. For that use:


MP4Box -hint yourfile.mp4

Well, lets move now to watch live television, in my case dvb-t channels. There are some texts on the internet on how to make vlc read from your tv-card, for example this one. But for this tutorial I prefer to access separately each channel, you would have to know the frequency's and other stuff to set it up, and to know that, you can review your channels.conf file after you scan the card with your country/zone settings.
I did it with Madrid-Spain channels, yes I live here, if you want to take a beer let me know :-).
For example let's test that we can see TV with vlc, for example with:

vlc dvb:// --dvb-adapter=1 --dvb-frequency=706000000 --dvb-bandwidth=8 --program=5001

wow, vlc, probably the best media player of the history of the media players.
If you can't get this working review your parameters with the channels.conf or go back to review the outputs of your installation to solve other problems. More information about this in http://www.videolan.org/doc/videolan-howto/es/ch06.html

Finally we can stream creating a sdp file inside /usr/local/movies with the proper permissions, look at the ones that already have webcam.sdp inside that folder.
If you want to stream h264 codec it could be possible that you have to patch a file, h264.c, see more information here https://trac.videolan.org/vlc/ticket/1494

There are multiple ways to do the streaming, changing supported codecs and more options, the one I choose is the next one:


vlc -vvv --color --ts-es-id-pid dvb:// --dvb-adapter=1 --dvb-frequency=706000000 --dvb-bandwidth=8 --program=5001 --sout-standard-access=udp --sout-standard-mux=mp4 --file-caching=3000 --sout'#transcode{fps=13,width=480,height=320,vcodec=mp4v,vb=96,scale=1,acodec=mp4a,\
ab=32,channels=1,cropleft=20,cropbottom=6,cropright=4,croptop=6}:\
duplicate{dst="rtp{dst=127.0.0.1,port=1230,sdp=file:///usr/local/movies/tv.sdp}"}'

note that I use --dvb-adapter=1 because my card is an hybrid one that has dvb-t and dvb-s and the adapter for dvb-t is 1, usually you would have to use 0, also the codecs used by me are mp4v for video, mp4a for audio and muxer mp4. It is also possible to increase the video bitrate(vb=96) to obtain more image quality. Feel free to change the settings for your case.

You can test first that the streaming is working from another station via wifi, by typing something like

vlc rtsp://yourserver/tv.sdp

don't worry if the size of the image looks weird, the important thing is to have a good image on the G1.
I tried to play it with Meridian player because the rtsp support, I got it from the market, but I didn't have good results with rtsp streams. So I moved to use the G1 built-in, that one that pops up when you visit youtube.
So what I did and because G1 browser doesn't allow to type a rtsp url was to make a little html page on the server machine with the rtsp links:


<html>
<head>
</head>
<body>
<a href="rtsp://serverip:port/tv.sdp">DVB Channel 1</a>
<a href="rtsp://serverip:port/myvideo.mp4">Myvideo.mp4</a>
<a href="rtsp://serverip:port/tv.sdp">DVB_channel_ssh?</a>
<a href="rtsp://myserver.dyndns.net:port/tv.sdp">Internet stream?</a>
</body>
</html>


And then I access the url of that html in the server machine with the G1 browser and click on one of the links.
And there you are, you have live television, live videos, live mp3s wherever you are, streaming from your home.
note: The links with question mark (?) I haven't implemented yet, but looks possible, feel free to add your experience.

Wednesday, December 31, 2008

Escucha música

un pequeño regalito, viene bien para satisfacer todos los gustos en una fiesta.

Feliz 2009!!!!!!

http://songza.com/

Monday, December 22, 2008

Feliz Navidad

Bueno, pues eso, que espero que paséis unas felices navidades y una muy buena entrada de año rodeados de aquellos que más os quieren.

Playing for change: Song around the world "Stand by me"

Sunday, December 14, 2008

Instalando Ubuntu en la Play Station 3

Hace ya algún tiempo que tengo la ps3, elegí esta y no la xbox 360, porque sabía que la gente de Sony había hecho un guiño al software libre con esta consola. También alguna chapucilla como no tener un firmware actualizado para la gestión de auriculares con micro vía usb.
Así, dentro del menú principal hay una opción que nos sugiere instalar otro sistema operativo...


Finalmente hoy me he puesto manos a la obra, y siguiendo las recomendaciones para la instalación en

https://help.ubuntu.com/community/PlayStation_3

he finalizado la instalación de la version 7.10 y mediante kboot puedo seleccionar si cargar el sistema operativo de la play con un boot-game-os o bien ubuntu.


Las posibilidades que se me ocurren son muchas, la play viene equipada con un procesador cell , una gran potencia de cálculo que puede ser aprovechada con cualquier propósito, por ejemplo, para colaborar con el proyecto folding home de la Universidad de Stanford. En otras palabras, tu linux puede colaborar en la búsqueda de curas para enfermedades como el alzheimer, el parkinson y otras relacionadas con el cancer.
También es posible aprovechar su rendimiento en aplicaciones que muevan gráficos, por ejemplo para ver vídeos en alta definición, o bien hacer copias de seguridad de tus discos blue-ray mediante dd .

Por el momento no he decidido cambiar el disco duro de 40Gb que lleva, pero también es posible hacerlo por otro SATA de 5400rpm y 2,5p., por aquí se me ocurre montar un centro multimedia, backup de otros pcs, o montar unidades por red... ya veremos.

Una vez instalado y debido a que la ps3 sólo viene con 512 Mb de RAM, puedes adecuar tu distribución con algunos consejos que creas oportunos.


Friday, December 12, 2008




muestra de unos 15 días, los picos de bajada de temperatura son debidos al apagado del pc...

Friday, November 21, 2008

Configurar el mando de la wintv hvr 4000 en Ubuntu

Para hacer funcionar el mando a distancia de esta peacho tarjeta,

sudo apt-get install lirc lirc-x

configura: (fuente linuxtv.org)

Debian: edit /etc/lirc/hardware.conf
DRIVER="dev/input"
DEVICE="/dev/input/eventX"



y para que funcionen las teclas para el kaffeine(gran programa) edita:

/etc/lirc/lircd.conf (Works)

con la siguiente información:

begin remote

name Hauppauge-HVR4000-Remote
bits 16
eps 30
aeps 100

one 0 0
zero 0 0
pre_data_bits 16
pre_data 0x8001
gap 133325
toggle_bit_mask 0x8001001C

begin codes
Power 0x0074
Go 0x0161
TV 0x0179
Video 0x0189
Music 0x0188
Pictures 0x016F
Guide 0x016D
Radio 0x0181
Up 0x0067
Down 0x006C
Left 0x0069
Right 0x006A
OK 0x001C
Back/Exit 0x00AE
Menu 0x008B
PrevCh 0x019C
Mute 0x0071
Vol+ 0x0073
Vol- 0x0072
Ch+ 0x0192
Ch- 0x0193
Rec 0x00A7
Stop 0x0080
Play 0x00CF
Pause 0x0077
Rewind 0x00A8
Forward 0x00D0
Replay 0x00A5
Skip 0x00A3
1 0x0002
2 0x0003
3 0x0004
4 0x0005
5 0x0006
6 0x0007
7 0x0008
8 0x0009
9 0x000A
0 0x000B
Text 0x0184
Sub/CC 0x0172
Red 0x018E
Green 0x018F
Yellow 0x0190
Blue 0x0191
end codes

end remote


Para que todo se inicie al arranque del ordenador necesitarás iniciar lircd con permisos de root, para ello edita el fichero /etc/rc.local, añade la carga del demonio lirc allí.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

logger "iniciando lircd"
sudo lircd --driver=dev/input --device=/dev/input/eventX
exit 0


mira dentro de dmesg para asignar el número X concreto al event del device.

También son necesarios los procesos irxec e irxevent lanzados como demonios -d, para ello yo he creado un script con permisos de ejecución en init.d. Probé a iniciarlos con el aranque mediante un update-rc.d defaults, pero necesitan tener cargadas las X de Ubuntu primero para funcionar, lógico, vienen del paquete lirc-x. Así que dentro de System-Preferences-Sessions de tu Ubuntu añade la ejecución de /etc/init.d/lircinit

chmod +x /etc/init.d/lircinit

more /etc/lircinit
#!/bin/bash
#echo "iniciando lircd"
logger "iniciando irexec"
irexec -d
logger "iniciando irxevent"
irxevent -d

Reinicia tu ordenador y comprueba que se han arrancado

tail -n 100 /var/log/messages

....


yo@peachomaquina:/$ ps aux | grep ir
root 7124 0.0 0.0 2932 552 ? Ss 20:06 0:00 lircd --driver=dev/input --device=/dev/input/event5
yo 7305 0.0 0.0 1716 332 ? Ss 20:06 0:00 irexec -d
yo 7310 0.0 0.0 2936 644 ? Ss 20:06 0:00 irxevent -d
yo 11837 0.0 0.0 4068 788 pts/1 S+ 23:15 0:00 grep ir



ps: no me hago responsable del aumento de peso de los lectores ;-)

Saturday, November 08, 2008

Marriage of Figaro - Le Nozze Di Figaro (The Shawshank Rdmp)



otra de las mejores películas de la historia de las películas...

Youtube link: http://www.youtube.com/watch?v=U8z_i3NAxbM

Monday, September 15, 2008

Convierte tu escritorio en un mapa mundial en tiempo real


Para ello sólo debes descargar la imagen de satélite desde una dirección concreta, y hacer esto cada hora. Para ello crea una nueva entrada en tu cron del estilo de esta:

5 0-23 * * * wget -N http://static.die.net/earth/mercator/1600.jpg >/dev/null 2>&1

y luego en tu linux seleccióna que la imagen de tu escritorio sea 1600.jpg que seguramente estará en tu directorio /home/

Por cierto la redirección >/dev/null 2>&1 sirve para hacer que la descarga no produzca mensajes y sea una descarga discreta.

Sunday, September 14, 2008

Cómo instalar impresora y escaner Epson CX 4400 en Linux

Vuelta de nuevo al trabajo y también a estas pequeñas notas del blog.
Hace ya unos cuantos meses compré la impresora más barata de la historia de las impresoras, o por lo menos, la más barata que encontré en la tienda a la que fuí. Ojo, previamente me cercioré de que los cartuchos para esta impresora no fueran demasiado caros.
Así que esta vez me lancé un poco a la piscina y adquirí una Epson CX 4400 por unos 30 euros si no recuerdo mal. La impresora es una multifunción que además soporta funciones de escaner.

Todo bien hasta que intenté utilizarla con mi pingüino Ubuntu 8.04, el sistema la reconocía a la primera pero no funcionaba, yo daba a imprimir y la impresora se reía de mi.
Así que cada vez que necesitaba imprimir tenía que bajar la cabeza, dejar el orgullo linux, y arrancar Windows Xp, que porqué no decirlo, es el mejor sistema operativo que Microsoft ha puesto en la calle.

Así que seguí el procedimiento estándar de meter CD acompañado de la impresora y utilizarla sobre Micro$oft. Menuda experiencia, casi me da algo al ver que el controlador de la impresora se centra exclusivamente en decirte lo poco que te queda de tinta, vamos realmente sólo se dedica a asustarte con el tema de la tinta. Así es, que un buen día, sin que yo pudiera observar que ya no imprimía en condiciones, me dijo que tenía que cambiar cartuchos, así sin más, sin darme una evidencia sobre un papel borroso. Y la impresión paró, el jodido programa que a alguna persona le obligaron programar no permite continuar imprimiendo ni una receta en plan cutre para utilizarla en casa.

Bueno pues hoy después de basarme en un post de Toranks , en unos minutos he obtenido la solución.

Primero conecta tu la impresora por USB al pc, enciéndela y Ubuntu reconocerá la nueva impresora, y tú deberás seleccionar el siguiente driver:

Epson Stylus DX3850 - CUPS+Gutenprint v5.0.2 Simplified, el que te dice recomended.

En el siguiente paso elige:

"Use the new PPD (Postscript Printer Description) as is.
This way all current option settings will be lost. The default settings of the new PPD will be used."

no elijas la otra opción porque parece que no funciona.

Así tendrás configurada la parte de impresión en tu Linux, sin un programa gráfico que dañe a la vista con los supuestos niveles de tinta.

Nos falta las posibilidades de escaneo de la impresora, así para ello buscaremos los drivers open-source en la siguiente página:

http://www.avasys.jp/lx-bin2/linux_e/spc/DL1.do

Donde elegiremos el módelo de la impresora, en mi caso CX 4400 y bajaremos los ficheros siguientes:


iscan-2.10.0-1.c2.i386.rpm

iscan-plugin-cx4400-2.0.0-0.c2.i386.rpm


Bajaremos los rpm y los cambiaremos a paquetes .deb, si no tienes alien instalado, pues haces un

sudo apt-get install alien

sudo alien --scripts -d iscan-2.10.0-1.c2.i386.rpm

Y luego


sudo alien --scripts -d iscan-plugin-cx4400-2.0.0-0.c2.i386.rpm


Una vez habilitados los paquetes para Ubuntu sólo tendremos que instalarlos, por ejemplo con un doble click desde Nautilus.

Así y con estos simples pasos podremos hacer un uso más libre de nuestra modesta impresora :-)

Friday, August 15, 2008

sistema de goteo casero para vacaciones

:-)
Haz un par de agujeros con un alfiler al tapón, llena la botella y enchúfasela a la tierra, con litro y medio tienes para unas dos semanas de verano apuraditas.

Sunday, August 10, 2008

4 días para vacaciones...

Supervisión de procesos en UNIX

No sé si existe algo parecido para servidores windows, si lo hay, irremediablemente conllevará su paso por caja, aunque este no es el tema de hoy.

Me imagino que muchos de vosotros habréis sufrido la caída de servicios o procesos en vuestras máquinas Unix, ya sea en el trabajo o en vuestra casa, y hasta pasado un buen tiempo no os habréis dado cuenta, con lo que eso supone: usuarios enfadados, la peli que te estabas copiando por rsync parada, tu sistema de seguridad caído, tu mythtv parado obligándote a levantarte del sofá, un dns que administras parado, tu web caída....
Pues bien, daemontools se encarga de monitorizar los procesos que le indiques y los levantará automáticamente si estos han caído por algún motivo.

Si quieres aumentar la productividad de tus aplicaciones, es recomendable que utilices daemontools , este paquete, que no he conseguido encontrar en los repositorios de Ubuntu es tu salvación.

A continuación expongo los pasos a seguir para hacerlo funcionar en Ubuntu Hardy 8.04, aunque también puedes instalarlo en tu distribución preferida. Yo por ahora sólo lo he probado en Gentoo y Ubuntu.

apt-get install build-essential
mkdir -p /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
gunzip daemontools-0.76.tar
tar -xpf daemontools-0.76.tar
rm daemontools-0.76.tar
cd admin/daemontools-0.76
touch /etc/inittab
package/install

Aquí seguramente te dará un error del tipo "/lib/libc.so.6: could not read symbols: Bad value"
para solucionarlo y poder compilar sin problemas sólo tienes que editar el fichero "error.h" y eliminar la línea "extern int errno;" sustituyéndola por "#include <errno.h>" Después de ésto ya podrás ejecutar sin errores package/install. Una vez instalado dentro del directorio /service/ deberás crear un directorio por cada proceso que necesites supervisar y dentro del mismo crear un fichero ./run donde indicar el proceso a ejecutar. Puedes incluir también variables de entorno creando un subdirectorio ./env y también generar logs.

Para ver todas las posibilidades de este paquete lo mejor es que vayas a tu frigorífico cojas una cerveza bien fría y te des un paseo por la web del autor.
http://cr.yp.to/daemontools.html