2005年10月26日

用 MPlayer 播放電視

剛剛測試出使用 MPlayer 播放電視的方法:

首先當然要有一張電視卡,而且已經完成驅動程序。通常在 kernel 若有支援的話可直接編譯成 module 形式,然後讓 kernel 自動載入即可。

電視卡相關驅動程式清單
ada@www ~ $ lsmod | grep saa
saa7134                94280  0
video_buf              17156  1 saa7134
v4l2_common             4992  1 saa7134
v4l1_compat            12548  1 saa7134
ir_common               4228  1 saa7134
videodev                7680  1 saa7134
i2c_core               18176  5 tuner,saa7134,eeprom,i2c_sensor,i2c_amd756
ada@www ~ $

MPlayer 指令可參考 man 的說明,以下是簡單的使用範例。

mplayer tv://19 -tv driver=v4l2:chanlist=us-cable:volume=50:decimation=2:input=2:normid=4

其中 MPlayer 會將可使用的 input 及 normid 值列出來,記得確定輸入設定 (input) 及播放規格 (normid) 要符合電視卡及所在區域的設定。另台灣第四台使用的頻道列表是 us-cable 。

播放 19 頻道時的輸出參考
www ~ # mplayer tv://19 -tv driver=v4l2:chanlist=us-cable:volume=50:decimation=2:input=2:normid=4
MPlayer 1.0pre7try2-3.3.5-20050130 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon MP/XP Thoroughbred (Family: 6, Stepping: 1)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE

85 audio & 196 video codecs Playing tv://19. Cache fill: 0.00% (0 bytes) TV detected! ;-) Selected driver: v4l2 name: Video 4 Linux 2 input author: Martin Olschewski <olschewski@zpr.uni-koeln.de> comment: first try, more to come ;-) Selected device: Compro VideoMate TV Tuner cap: STEREO LANG1 LANG2 Tuner rxs: MONO Capabilites: video capture video overlay VBI capture device tuner read/write streaming supported norms: 0 = PAL; 1 = PAL-BG; 2 = PAL-I; 3 = PAL-DK; 4 = NTSC; 5 = SECAM; 6 = PAL-M; 7 = PAL-Nc; inputs: 0 = S-Video; 1 = Composite1; 2 = Television; Current input: 2 Current format: BGR24 v4l2: current audio mode is : MONO Selected channel: 19 (freq: 151.250) vo: X11 running at 1280x1024 with depth 24 and 32 bpp (":0.0" => local display) ========================================================================== Opening video decoder: [raw] RAW Uncompressed Video VDec: vo config request - 640 x 480 (preferred csp: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 640x480 => 640x480 Planar YV12 Selected video codec: [rawyv12] vfm:raw (RAW YV12) ========================================================================== Audio: no sound Starting playback… v4l2: 475 frames successfully processed, 0 frames dropped.

Exiting… (Quit)

這樣做能幹嘛?好像可以做成預約錄影的樣子,有空會測試這一個功能!