If your video doesn't appear to be in-sync with your audio, it could be because you are listening to the real-time audio from your video card rather than after it's been processed and synchronized to the video by MythTV. Because MythTV is a personal video recorder, "Live TV" isn't really live - to let you pause live TV, MythTV is actually encoding the video, saving to disk, and then playing it back. This procedure puts your MythTV "live" TV about 2 seconds behind real-time, so it's important that you're not listening to the live audio. However, if you're having an issue where the audio and video aren't synchronized by small but varying amount, it's most likely because the sound driver that you're using doesn't have the DSP_CAP_REALTIME capability. This was the case with ALSA (0.5), but not with newer versions (0.9). See the Troubleshooting Audio section for more information if you're having issues with sound. Also, ensure that no other programs are grabbing the audio output, like arts or esd.
What you need to do is to mute the "line-in" of your sound card and also set it as the recording source.
There are two ways to do this. Graphically, and from the command line.
Open Kmix by clicking K->Multimedia->Sound->Kmix for Mandrake, or
RedHat Menu>Sound & Video>Volume Controlon Red Hat.
Click on Settings->Configure Make sure that "Tick Marks" and "Show labels" have "X"'s in them. This will make it easier to find the correct audio source. Click OK.
On the mixer page, look for Line-In on your sound card. You should see two LED's - a green one at the top, and a red one at the bottom. The green one at the top is for muting; you want to make sure that the green LED is a dark green, meaning that it's "off". You also want to click on the red LED so that it turns bright red, indicating that it's "ON"; this insures that the Line-in is used as the source. Click OK, and make sure that you save the settings so that this is your default.
Red Hat Linux 8.0 ships with OSS sound drivers rather than the ALSA drivers recommended by the MythTV team. The OSS drivers do work for many people, and for many cards. We recommend that you give OSS a try since it is already included in Red Hat 8. However, some people report problems (sync and jitter) with OSS, and in addition it does not support full duplex on some cards. Full duplex is required if you want to record and play sound using just one sound card. ALSA has good full duplex support, and also has drivers for some built-in (motherboard) sound cards that OSS does not. Installing ALSA is less painful than you might think, so if OSS does not work for you, installing ALSA is not too difficult. For those of you who do not wish to install ALSA you must do this:
To configure sound to work with MythTV, select
RedHat Menu>Sound & Video>Volume Controlto open up a mixer. Make sure your global volume (on the far left) is up. Also make sure that the "line in" section has "mute" and "record" checked and that the gain is turned up. You may have to experiment with volume/gain levels to get the best sound.
For those of you who do want to install ALSA please follow the directions below, compiled with much assistance from Gregorio Gervasio.
First you must find out the name of your driver, which isn't necessarily the same as the name of your sound card. Go to http://www.alsa-project.org/alsa-doc/, find your sound card on the list and click "details". Near the top it will say something like "The module options for snd-XXX", where XXX is the name of your driver. In the instructions below, replace "XXX" with the name of your driver.
Download the development release (0.9.x) from the ALSA web site http://www.alsa-project.org. You need at least three files:
Start with the alsa-driver package:
$ tar -xjf alsa-driver-0.9.x.tar.bz2
$ cd alsa-driver-0.9.x
$ ./configure --with-cards=XXX --with-sequencer=yes
$ make
$ su
# make install
# ./snddevices
# exit
$
This will compile and install the kernel modules and initialization scripts, as well as create device nodes in /dev.
Install the rest of the packages:
$ cd ~
$ tar -xjf alsa-lib-0.9.x.tar.bz2
$ cd alsa-lib-0.9.x
$ ./configure
$ make
$ su
# make install
# exit
$ cd ..
$ tar -xjf alsa-utils-0.9.x.tar.bz2
$ cd alsa-utils-0.9.x
$ ./configure
$ make
$ su
# make install
Next, you must edit /etc/modules.conf
so that the ALSA modules are
loaded automatically. The first step is to remove your old OSS
configuration to ensure that you don't end up with mysterious conflicts in
the future. You should end up with a /etc/modules.conf
file that has
this configuration:
alias char-major-116 snd
alias snd-card-0 snd-XXX
# module options should go here
# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
# card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
"XXX" should be the ALSA driver name for your sound card/chip. In some rare cases you need to supply extra options to the driver. These options are descried in the "INSTALL" file in the alsa-driver directory or at http://www.alsa-project.org/alsa-doc/.
For now we will assume that no extra options are required. The next step is to ensure that the ALSA drivers are started during boot-up.
$ su
# cd /etc/rc.d/init.d
# /sbin/chkconfig --add alsasound
The next set of instructions will cause the ALSA volume/mixer/etc. state to be saved when the machine is shut down properly. Note that the mixer settings won't get restored the next time you boot unless you ran the shutdown script or you've explicitly saved the state which you can do as root with:
# alsactl -f /etc/asound.state store
Reboot your machine. Login and adjust the sound levels using "alsamixer". You should increase the main volume (the first slider) and the PCM volume, and unmute them by hitting "m". For MythTV, if your tuner card audio output is patched to the Line-In input of your sound card, set the Line input for capture by pressing SPACE at the slider and mute it by pressing "M". If you've patched your tuner card to the Mic-In port of your sound card, follow the same instructions but make sure that you're on the Mic slider.
Test the driver by playing a simple file:
$ aplay /usr/share/sounds/info.wav
If it works, you're done installing ALSA!
If you have installed the alsa-utils package, then the amixer program can be used to setup the mixer. The "Master" volume setting is only required on a frontend machine to ensure that the sound channels are unmuted and configured for outputting sound. The "Line" and "Capture" controls are required for your sound card to actually capture audio from the external Line-in. Not all sound cards have a "Capture" control, but if yours does and you don't set it then MythTV will not capture audio.
Note the spelling in the following commands.
$ amixer set Master,0 100%,100% unmute
$ amixer set Line,0 75%,75% mute captur
$ amixer set Capture,0 100%,100% mute captur
$ su
# alsactl store
# exit
$
If you have multiple sound cards, then use the -c
parameter to
specify which card to adjust. Note that the first card will be "0", the
second will be "1", etc.
That takes care of setting the volume correctly, and the ALSA startup script
will restore the volume after a reboot. If you find that your sound is
distorted, it's possible that the levels in the above examples are too high
for your particular hardware combination. Try reducing the percentages by
5-10% and checking again. Once you're satisfied, re-run the alsactl
store
command.
You may also use the alsamixer program to set the volume. First, start alsamixer from the command line. You should start out on the "Master" volume control slider. Use the up and down cursor to set the master volume to around 75%. Next, use the left and right cursor keys to move around on the screen until you find the "Line" slider. Press SPACE to set it as the capture source, set the level to around 50-75% and press "M" to mute it. You can now press ESC to exit out of the alsamixer program. You can also have MythTV manage all volume and mute settings, but this will only affect the "Master" or PCM volume, not the capture volume. See the mythfrontend setup page for options.