mycroes

There's always time to play
Showing posts with label mplayer. Show all posts
Showing posts with label mplayer. Show all posts

Sunday, June 28, 2009

Watching TV with mplayer

Occassionally I want to watch something on my computer, and currently I'm using mplayer to do so. When I finally was able to play video and sound at the same time, I decided I wanted to have a bit easier way to watch tv then constantly searching for my mplayer command. So I made a small shell script, and while I was at it I added in the channel list so I can just start watching without searching frequencies too, so here it is:
#!/bin/bash

#OPTS="-fs"
FILTER="-vf pp=lb,crop=672:420"
OUTPUT="-vo gl -ao pulse"

CHANNELS="768000-Nederland_1,\
776000-Nederland_2,\
784000-Nederland_3,\
752000-RTL_4,\
744000-RTL_5,\
736000-SBS_6,\
728000-RTL_7,\
712000-Veronica,\
704000-Net_5,\
496000-Discovery_Channel"

TV="-tv outfmt=i420:chanlist=europe-west:width=720:height=576:amode=1:alsa:adevice=hw.2,0:forceaudio:immediatemode=0:channels=$CHANNELS"

mplayer $OPTS $FILTER $OUTPUT $TV tv://$1

As you can see I'm using the first argument as channel, so you can invoke this script with a channel number to immediately select a channel on startup, but leaving out the argument will just start mplayer on the first channel.

Last but not least, you can switch channels by binding keys to tv_step_channel 1 and tv_step_channel -1, in Ubuntu these are bound to h and l by default, and I suspect this to be the upstream default.

Sunday, March 1, 2009

Playing videos on a second display using mplayer

I decided I didn't need my home theatre pc anymore, because I don't record that much anymore (and that's the thing I liked most about it). I do however still have the need to play stuff on my tv and watch it from my bed, so I started by using mplayer to play videos to my already connected tv. I'm not covering the display setup here, just the needed information. My tv is display :0.1, I have multiple sound cards (my desktop speakers feature an internal soundcard), and the one my tv is plugged into is hw:1.0 (alsa). Putting this together with stuff lyign around on the web you get this:
DISPLAY=:0.1 mplayer -vo xv -ao alsa:device=hw=1.0 -fs /path/to/file

Using the above I have audio and video from my tv, so when I'm done watching I can turn the tv off and go to sleep... Now all I need is a remote!