Also see the [[Saa7134-alsa redundant]] article; whose info (if it is not redundant) should/will be merged (preferably by its authour so that proper user attribution is maintained for information additions) into this original existing article.

+

=== How to use alsa or oss with saa7134 ===

=== How to use alsa or oss with saa7134 ===

Line 160:

Line 162:

Here again you can run the scantv utility to detect the channels available from your provider, or you can use your provider's channel table.

Here again you can run the scantv utility to detect the channels available from your provider, or you can use your provider's channel table.

−

If "adevice=hw.1,0" doesn't work, try simply "adevice=hw.1". Some tuners require "adevice=hw.2" -- for instance, on a board with nforce 3 250/gb chipsets. If others experiance this with other boards, please update.

Note the ''norm='' and ''chanlist='' parameters. Adjust as required for your location.

+

+

If "adevice=hw.1,0" doesn't work, try simply "adevice=hw.1". Some tuners require "adevice=hw.2" -- for instance, on a board with nforce 3 250/gb chipsets. If others experiance this with other boards, please update.

=== Record with mencoder ===

=== Record with mencoder ===

−

It may be simpler to get sound during recording than during playback. I get good sound using this, where $DEV is the number of the device node:

+

It may be simpler to get sound during recording than during playback. The example given below, in which "$DEV" is the number of the device node, is known to produce good sound:

So the alsa device is simply called hw.1 -- not hw.1,0. The line is taken from the [[channel script]]. You may find you need to use hw.2 instead, depending on the audio hardware on your system.

+

So the alsa device is simply called hw.1 -- not hw.1,0. The line is taken from the [[V4L channel script]]. You may find you need to use hw.2 instead, depending on the audio hardware on your system.

Neither ffmpeg nor transcode as yet have ALSA support.

Neither ffmpeg nor transcode as yet have ALSA support.

Because so many applications still appear to have difficulties accessing ALSA's odd device enumeration, the OSS module for DMA sound continues to be useful. You can also use ALSA's OSS emulation with saa7134-alsa to get /dev/dspX devices for OSS-aware applications.

Because so many applications still appear to have difficulties accessing ALSA's odd device enumeration, the OSS module for DMA sound continues to be useful. You can also use ALSA's OSS emulation with saa7134-alsa to get /dev/dspX devices for OSS-aware applications.

+

+

=== Using with Mplayer, Mencoder with Gentoo default Pulseaudio and Alsa config ===

+

+

If you are using default SAA7134 Pulseaudio settings (Analog Stero Input with the video channel being captured), then you can try command line for composite signal capture:

This line has been successfully tested, recording a good few gigabytes, from a Virginmedia V+HD box.

+

+

These lines were created with the help of this very page and the Mplayer/Mencoder manual.

=== ALSA audio with other applications ===

=== ALSA audio with other applications ===

Line 199:

Line 220:

sox -r 32000 -w -t alsa hw:1,0 -t alsa hw:0,0

sox -r 32000 -w -t alsa hw:1,0 -t alsa hw:0,0

+

+

Recent versions of sox no longer accept "-w" option, so just omit it. You can also use "--buffer" option to improve A/V synchronization, as the default 8KB buffer causes audio to lag significantly. On my system 2KB buffer is optimal:

+

+

sox --buffer 2048 -r 32000 -t alsa hw:1,0 -t alsa hw:0,0

Sox might get you mono sound, while all the alsa solutions cause delays. A combination has been known to work:

Sox might get you mono sound, while all the alsa solutions cause delays. A combination has been known to work:

* If your Saa713x device is properly configured and still can get no sound with TVTime, you may to redirect the input source from your TV card to the output of your sound card. You must load the [http://pulseaudio.org/wiki/Modules#module-loopback loopback module] with the command:

+

$ pactl load-module module-loopback

+

It will redirect the default input to the default output. The default input may not be the right one, you can change it in the 'Recording' tab with 'All Streams' displayed with Pulseaudio Volume Control (pavucontrol)

* On some card, the sound is distorted, high-pitched as if it is accelerated. Some program will output buffer underrun in the terminal. Fixed for newer kernel: http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=7b54360293c9d72b54e462d146c9376287d2f71b

+

* To correct this problem we need to change the autodetected sampling rate of the TV card from to 32000Hz.

Latest revision as of 03:38, 4 January 2013

Also see the Saa7134-alsa redundant article; whose info (if it is not redundant) should/will be merged (preferably by its authour so that proper user attribution is maintained for information additions) into this original existing article.

To then load the new driver that lets you get sound off the PCI bus via ALSA or OSS, you would normally just issue "sudo modprobe saa7134-alsa" or "sudo modprobe saa7134-oss". You can also deliberately assign the enumeration; for instance, for four cards, do this for alsa:

If you're using a satellite box, $channel should probably be set to 3 or 4. If that doesn't work, try the US cable TV setup below.
If you're getting your broadcast off the air, you can run the scantv utility to detect stations and set $channel to the local channel for your area.

Note the norm= and chanlist= parameters. Adjust as required for your location.

If "adevice=hw.1,0" doesn't work, try simply "adevice=hw.1". Some tuners require "adevice=hw.2" -- for instance, on a board with nforce 3 250/gb chipsets. If others experiance this with other boards, please update.

Record with mencoder

It may be simpler to get sound during recording than during playback. The example given below, in which "$DEV" is the number of the device node, is known to produce good sound:

So the alsa device is simply called hw.1 -- not hw.1,0. The line is taken from the V4L channel script. You may find you need to use hw.2 instead, depending on the audio hardware on your system.

Neither ffmpeg nor transcode as yet have ALSA support.

Because so many applications still appear to have difficulties accessing ALSA's odd device enumeration, the OSS module for DMA sound continues to be useful. You can also use ALSA's OSS emulation with saa7134-alsa to get /dev/dspX devices for OSS-aware applications.

Using with Mplayer, Mencoder with Gentoo default Pulseaudio and Alsa config

If you are using default SAA7134 Pulseaudio settings (Analog Stero Input with the video channel being captured), then you can try command line for composite signal capture:

This line has been successfully tested, recording a good few gigabytes, from a Virginmedia V+HD box.

These lines were created with the help of this very page and the Mplayer/Mencoder manual.

ALSA audio with other applications

To hear the audio through ALSA using tvtime (or other programs that don't support it directly), run the following command after starting tvtime:

arecord -D hw:1,0 -r 32000 -c 2 -f S16_LE | aplay -

It basically records at 32kHz Stereo from the SAA7134 ALSA source (hw:1,0 or change accordingly), and plays it through your default ALSA output. Look at the options from aplay to change your output.

There might be a delay between the video and the audio. To avoid it, specify a device for aplay (not the 'default' device):

arecord -D hw:1,0 -r 32000 -c 2 -f S16_LE | aplay -D surround41

In order to get full surround sound from the stereo TV audio output, edit your /etc/asound.conf or ~/.asoundrc file as described in ALSA FAQ028 (http://alsa.opensrc.org/FAQ028) and use this device:

arecord -D hw:1,0 -r 32000 -c 2 -f S16_LE | aplay -D ch51dup

I don't know how to use ALSA directly with xawtv, motv, kdtv, tvtime, or zapping; if you do, please add it in here!

If using arecord still causes a delay between the video and the audio, try using sox:

sox -r 32000 -w -t alsa hw:1,0 -t alsa hw:0,0

Recent versions of sox no longer accept "-w" option, so just omit it. You can also use "--buffer" option to improve A/V synchronization, as the default 8KB buffer causes audio to lag significantly. On my system 2KB buffer is optimal:

sox --buffer 2048 -r 32000 -t alsa hw:1,0 -t alsa hw:0,0

Sox might get you mono sound, while all the alsa solutions cause delays. A combination has been known to work:

Howto use Saa7134-alsa with Pulseaudio based-system

Redirect the sound with pulseaudio loopback module

If your Saa713x device is properly configured and still can get no sound with TVTime, you may to redirect the input source from your TV card to the output of your sound card. You must load the loopback module with the command:

$ pactl load-module module-loopback

It will redirect the default input to the default output. The default input may not be the right one, you can change it in the 'Recording' tab with 'All Streams' displayed with Pulseaudio Volume Control (pavucontrol)

Example of loopback module selection in Pulseaudio Volume Control

The sound should now works. To automate the process, we will edit /etc/pulse/default.pa

First we need to now what is the TV card source name in pulseaudio. You can know the PCI address of your card with