Wednesday, May 21, 2008

Command line to watch TV in Fedora


mplayer \
-framedrop \
-ao alsa:device=hw=1 \
-autosync 1 \
tv://7 \
-tv driver=v4l2:device=/dev/video0:chanlist=newzealand
:norm=1:alsa:adevice=hw.2:audiorate=32000:amode=1:\
forceaudio:immediatemode=0:tdevice=/dev/vbi0:\outfmt=yuy2:\
channels=2-TV1,4-TV2,7-TV3,9-C4,41-Maori,57-Juice,59-Prime,62-Chinese \
-nolirc \
-aspect 1440:900

Mplayer with the following command options set:


  • -framedrop => hard framedropping
  • -ao:alsa:device=hw.1 => Sound output ( what you hear ) alsa card number 1. To be clear: THIS IS THE SOUND OUTPUT - not the INPUT from the TV card. That comes later.
  • -autosync 1 => Something to do with trying to get sound and video in sync. Works in small increments... ?
  • tv://7 => Play channel 7
  • tv: => Followed by all the sub options for tv
  • :driver=v4l2 => the Video 4 Linux driver v2
  • :device=/dev/video => the video device as enumerated by the kernel
  • :chanlist=newzealand => specify New Zealand channels. This is how the tuner gets tuned.
  • :norm=1 => PAL
  • :alsa => Use an alsa soundcard for input. This is where we specify the onboard sound card for the TV AUDIO INPUT... You could use a loopback cable from the audio out on your card to the aux in on your main sound card... In my experience this adds about a 1 second delay. Mplayer does allow for that delay to be fixed while watching TV using keystrokes. See man mplayer for mor.
  • :adevice=hw2 => on my computer when I type "cat /proc/asound/cards" the second card is listed is the sound device on the tv tuner. My TV tuner is supported in ALSA so this makes it easy. Try looking up your card on the V4l website for help. It might help to know the kind of chip that is on your card when you look this up.
  • :audiorate=32000kbits => this seems to be required by my card...
  • :amode=1 => again another requirement. Play with these settings on your card.
  • :forceaudio => f o r c e a u d i o
  • :immediatemode => Again - this is just something that worked while not having it there made for strange speeded up sound and glitchy tv.
  • :tdevice=/dev/vbi0 => Teletext device as enumerated by my kernel.
  • :outfmt=yuy2 => I read that this is a default for New Zealand analogue tv.
  • :channels #-name,#-name where # is the channel number and name is the channel name. The name appears on the OSD ( ON SCREEN DISPLAY ) when switching channels. You dont have to append this but its nice and I have all the auckland channels I get with my bunny ears and bits of coathanger and the wifes underwire... ( only joking - she took the underwires away when we had some guests arrive one time. Something about dignity and ... I don't really remember because I was thinking at the time that dignity comes second to qualtiy tv on the desktop... :) ) - Thats the end of the TV sub options by the way.
  • -nolirc => I cant find my remote control so I didnt bother with it. This just tells mplayer to not bother too. If you leave it out there is a warning in the bash prompt about it.
  • -aspect=1440:900 => when viewing in full screen I like it to be full screen.

Key strokes: ( not all of them but the useful ones anyway. )

  • h = Channel UP ( from 1 to 2 2 to 3 etc. )
  • k = Channel DOWN ( from 3 to 2 2 to 1 etc )
  • f = full screen toggle ( f to turn it on and f to turn it off or F-ON F-OFF... :)
  • NUMPAD + and NUMPAD - = increase or decreas the AV-DELAY in 100 millisecond intervals. This is handy when your audio is out of sync with your tv.
  • q = quit
  • ( ) = VOLUME DOWN AND UP
  • m = MUTE
  • o = OSD toggle. Keep pressing it until you are happy.
VIOLA!