Search:  
Gentoo Wiki

Saa7134_quick_guide

Contents

About

This is a vastly simplified guide to get your saa713x based card up and running quick and effortlessly. It is not to be considered a replacement in any way to SAA7134, but the minimum steps required to get started.

I wrote this quick guide mainly due to the following flaws in the above current guide:


Note: As reference I have an ASUS TV-FM 7134 card and that is the only v4l hardware I have in my computer. Things might thus look slightly different for you with another saa713x card and/or if you have a lot of other v4l devices (USB web cameras etc). To cause less confusion I would recommend unplugging all such USB v4l devices before you get started.


Please do the following if you have a saa7130/4 TV tuner card with Gutsy 7.10

In Terminal type: Code:

sudo gedit /etc/modprobe.d/options

Enter your password.

Then add the following line to the bottom of the file: Code:

options saa7134 card=81 tuner=54

Restart the computer. Then in Terminal type: Code:

tvtime-scanner

You should be able to tune channels.

Quick setup guide

1) Auto detection and kernel modules

Check if udev found your saa7314 card at boot and loaded all devices automatically.

If it did you should have a folder called /dev/v4l/ and in that 1-3 devices belonging to your card

  1. vbi0 (teletext)
  2. video0 (TV audio&video)
  3. radio0 (radio)

It is possible that your card is missing vbi and/or radio, but if you don't have at least video something isn't working as it should. Most likely cause, you didn't compile v4l and/or the saa713x module. Check by modprobe saa7134 -v


If it's not found you will have to add them as modules and recompile your kernel. Also remember to add the saa713x-alsa & saa713x-oss modules as well while configuring the kernel. Sooner or later you will probably want to use 1 of them to get audio, but for our short guide a simple cable from on board out of your TV card to an on board in on your sound card will be satisfactory. Once you have both picture as well as some sound you can start deciphering the full guide to figure out how to make DMA sound work.

2) Getting a Picture

Assuming you have a /dev/v4l/video0 device we start to test if we get a picture. Since likely you already have mplayer installed we wont mess with installing lots of other tools to do this. Just make sure you have mplayer compiled with v4l2 and then just do

example PAL

mplayer tv:// -tv driver=v4l2:norm=PAL:input=0:amode=1:width=384:height=288:outfmt=yv12:device=/dev/video0:chanlist=europe-west:channel=E2

example NTSC

mplayer tv:// -tv driver=v4l2:normid=4:input=0:amode=1:width=384:height=240:outfmt=yv12:device=/dev/video0:chanlist=us-cable


You might have to change the values of norm=, chanlist=, channel= according to where you live (refer to the full guide and man mplayer) but chances are high 1 of the 2 above will work as is.


3) Switching channels

You got picture? Good. Then either install specialized TV-software of your choise or continue using mplayer (I do). The h & k are the default keys for changing channel/frequency in Mplayer so if you take notes on a piece of paper as you step up/down you can then create an mplayer config or command line with all your channels.

All you need to know is in man mplayer, but here is my command line as an example:

mplayer tv:// -tv driver=v4l2:norm=PAL:input=0:amode=1:width=720:height=288:outfmt=yv12:device=/dev/video0:chanlist=europe-west:channels=E5-SVT1,E7-SVT2,E10-TV3,E8-TV4,SE18-Kanal_5,E9-TV6,SE14-TV4plus,S36-Discovery_Mix,SE8-TV9,E11-Eurosport,SE16-Barn_/_Kunskapskanalen,SE12-SVT_24,SE15-MTV,SE11-LokalTV -vf dsize=768:576

The above gives a non interlaced output even on quite slow computers that cant keep up with software real time deinterlacing. It uses the saa7134's built in ability to only show every second line of the original stream (which in effect means it becomes 100% progressive with 0 deinterlacing required). The backside is that you lose 50% of the horizontal detail and update frequency (an interlaced PAL picture is updated at 50Hz, this progressive trick makes it be "only" 25Hz), but these costs are usually quite bearable compared to the benefit of hardware 100% accurate deinterlacing.

Since the progressive output is half height we need to resize it, but at the same time we kill to birds with 1 stone by making the picture a proper 4:3 resolution of 768x576 (saa7134s output resolution is 720x576 which is not a proper 4:3 resolution but the same anamorphic res used on PAL DVDs).


Here is another alternative that uses full line height and adds some software deinterlacing:

mplayer tv:// -tv driver=v4l2:norm=PAL:input=0:amode=1:width=768:height=576:outfmt=yv12:device=/dev/video0:chanlist=europe-west:channels=E5-SVT1,E7-SVT2,E10-TV3,E8-TV4,SE18-Kanal_5,E9-TV6,SE14-TV4plus,S36-Discovery_Mix,SE8-TV9,E11-Eurosport,SE16-Barn_/_Kunskapskanalen,SE12-SVT_24,SE15-MTV,SE11-LokalTV -vf pp=ffmpegdeint

4) Sound

I assume you want sound, so that's next on the list. If you have a cable connected (same type usually shipped with computer CD/DVD players, try search for "universal cd rom audio cable") from your TV-card directly to your sound card all you should need to do is to unmute and increase the correct channel volume in your sound mixer of choice.

Note: If your motherboard has built-in audio then check the manual for Audio AUX_IN connector and connect one to your TV-tuner Audio output. Then start alsamixer -V capture, find Aux channel and set one to CAPTURE (press Spacebar to toggle). This is important to set proper capture input channel otherwise you will be able to hear TV only in headphones but all recorders (e.g. mencoder) will fail to record sound. The same apply if you decide to use Audio CD_IN connector.

You also have the option to use DMA sound with the previously mentioned -alsa or -oss kernel modules. However there is apparently a limitation with the saa7134 A/D audio converter so you can only get a sample rate of 32000Hz. Higher quality settings like 44100 (CD) or 48000 thus are only available with a "Mikey Mouse" voice. If the low 32kHz sample rate is the reason or there are just substandard quality components on my saa7134 board I dont know, but I definitely get superior audio with the cable option. Check what works best for you though.

Other tips

1) Teletext

You have a /dev/v4l/vbiX device? Well, you can get teletext as well then. AleVT in combination with mplayer (to switch program channels) works just perfect for my needs.

2) Mousebutton channel switching in Mplayer

If you use mplayer to view TV and have a mouse, I find it quite handy to put

MOUSE_BTN0 tv_step_channel -1
MOUSE_BTN2 tv_step_channel 1

into /home/youruser/.mplayer/input.conf file

3) Easy Recording

Want to record a TV-show? Well, there are lots of advanced software for this (some even extreemely advanced). But if you just want to make an occasional recording you can just save yourself a lot of compilation time and instead just stream the output to mencoder (included with mplayer) or use eg transcode.

I eg use this little neat script that I chmod +x and run when needed :)

#!/bin/sh

# http://www.transcoding.org/cgi-bin/transcode?Video4linux_Examples
# make sure to eg sudo modprobe saa7134-oss -v to get audio
# set channel with mplayer, quit, start recording, start mplayer for further change of channel during recording

TODAY=$( date +%Y%m%d )
NOW=$( date +%H:%M )

transcode \
        -x v4l2=resync_margin=1:resync_interval=250,v4l2 \
        -g 720x288 \
        -i /dev/video0 \
        -p /dev/dsp \
        -e 32000,16,2 \
        -N 0x1 \
        -J resample,levels,smartyuv,pv \
        -w 4000 \
        -y ffmpeg \
        -F mjpeg \
        -o /home/youruser/tv/${TODAY}-${NOW}-recording.avi \
        --avi_limit 3072
Retrieved from "http://www.gentoo-wiki.info/Saa7134_quick_guide"

Last modified: Tue, 02 Sep 2008 23:19:00 +0000 Hits: 18,453