Tag Archives: tv

Streaming Live TV to Android through http

I use a dvb device to record HDTV on my linux box, and want to stream the video to my new droid bionic. I found a decent solution using vlc. I mostly use this for football when I’m out of town.

 

vlc command

Took me a while to work this out:
cvlc -vvv dvb:// --dvb-frequency=FREQ --dvb-modulation=256 --sout '#transcode{soverlay,ab=42,samplerate=44100,channels=1,acodec=mp4a,vcodec=h264,width=640,height=352,vfilter="canvas{width=640,height=352,aspect=16:9}",fps=29.97,vb=400,venc=x264{vbv-bufsize=500,partitions=all,level=12,no-cabac,subme=7,threads=4,ref=2,mixed-refs=1,bframes=0,min-keyint=1,keyint=50,trellis=2,direct=auto,qcomp=0.0,qpmax=51}}: standard{access=http,mux=ts,dst=IP:PORT}'

where:
FREQ is the channel frequency (2nd column in your dvbscan file)
IP is the IP address to bind to
PORT is the port (I use 8080)

You can see if its running properly with:

vlc http://IP:PORT

on another machine.

 

Playing on android

I evaluated two apps to play http streams: Daroon Player and MoboPlayer. I couldn’t get MoboPlayer to work for more than a split second.

I use Daroon Player. It is free and in the Market. when you open it, hit the streams->menu->add. Give it a name and enter

http://IP:PORT

You can tell daroon player to use the hardware decoding on your phone to save batter/CPU.
Go to menu->settings->Decoding Mode and change http to Hardware Decoding.
The above encoding works on the hardware decoder on my droid bionic. I’ve heard it has a TI decoding chip (vs other ones on, say, the iphone) so you may need to change things.

There are still some issues I have to work out:

  • I couldn’t get audio to work using the software decoder in the Daroon Player. I really didn’t mind since I prefer the hardware decoder, but may be an issue for other phones.

 

Script

I use the following script to parse my channels file from DVB scan, and startup the server.


#!/bin/bash

SCANFILE=~/.mplayer/channels.conf
WIDTH=640
HEIGHT=352
ASPECT=16:9
VB=400

if [ $1 ] ; then
FREQ=`grep ^$1: $SCANFILE | awk 'BEGIN { FS = ":" } ; { print $2 }'`;
if [ $FREQ ] ; then
OP="#transcode{soverlay,ab=42,samplerate=44100,channels=1,acodec=mp4a,vcodec=h264,width=$WIDTH,height=$HEIGHT,vfilter=\"canvas{width=$WIDTH,height=$HEIGHT,aspect=$ASPECT}\",fps=29.97,vb=$VB,venc=x264{vbv-bufsize=500,partitions=all,level=12,no-cabac,subme=7,threads=4,ref=2,mixed-refs=1,bframes=0,min-keyint=1,keyint=50,trellis=2,direct=auto,qcomp=0.0,qpmax=51}}:standard{access=http,mux=ts,dst=192.168.1.102:8080}"
CMD="cvlc -vvv dvb:// --dvb-frequency=$FREQ --dvb-modulation=256 --sout "$OP
echo $CMD
$CMD >& /dev/null
else
echo "COULD NOT FIND CHANNEL $1!!!!"
exit 1
fi
else
echo "Usage: $0 [channel]"
fi