VLC

Streaming Live TV with VLC

I love Jim Cramer's show Mad Money on CNBC. Unfortunately I'm always at work when his show is on (18h). So, I figured I'd setup a system at home with a tuner and stream the show live to my computer at work. I bought a Hauppauge PVR-150 for about $70. I got this model because it also has an FM tuner which I want so I can stream a radio show I like and it's supported under Linux by ivtv.

IVTV Setup

It was a bit of a pain and I didn't take any notes, sorry

VLC configuration

I'm using H.264 for the video and MP4 for the audio. The quality is pretty good
# stream source
device=/dev/video1
norm=ntsc
capture_height=720
capture_width=480
bitrate=4000000
maxbitrate=8000000

# transcoding
width=448
height=336
fps=25

vcodec=h264
vbitrate=256

acodec=mp4a
abitrate=96
achannels=1

# streaming
access=http
mux=asf
bindaddress=
port=8080

vlc -vv --intf rc pvr:$device:norm=$norm:height=$capture_height:width=$capture_width:bitrate=$bitrate:maxbitrate=$maxbitrate \
--sout "#transcode{fps=$fps,width=$width,height=$height,vcodec=$vcodec,vb=$vbitrate,scale=1,acodec=$acodec,ab=$abitrate,channels=$achannels,cropleft=20,cropbottom=6,cropright=4,croptop=6,deinterlace}:duplicate{dst=std{access=$access,mux=$mux,dst=$bindaddress:$port}}"
  
I just have this config in a script so I can easily start it. This setups VLC to listen on port 8080 for HTTP.

Resolutions

Popular codecs prefer the height and width to be factors of 16. Of course you also want to maintain the aspect ratio.

for (my $w = 16; $w <= 1920; $w+=16) {
  my $h = $w / (16/9);
  print "$w x $h\n" if ($h % 16 == 0);
}
4:3 16:9
320 x 240
384 x 288
448 x 336
512 x 384
576 x 432
640 x 480
704 x 528
768 x 576
832 x 624
896 x 672
960 x 720
256 x 144
512 x 288
768 x 432
1024 x 576
1280 x 720
1536 x 864