I own a Terratec Cinergy 400 TV tuner card. This uses the saa7134 driver. I have OpenSuse 12.2 installed which uses PulseAudio. And I’ve installed the MPlayer suite from Packman.
I can watch TV and hear the sound if I activate the PulseAudio loopback module with the following commands:
pactl load-module module-loopback
pavucontrol # to show the volume slider gui
gmplayer tv:// -tv freq=471.23:driver=v4l2:device=/dev/video0:norm=PAL:input=0:decimation=1:quality=100:chanlist=europe-west
In the pre-PulseAudio days I used to be able to record with a variant of the following command:
SOUNDDEVICE=/dev/dsp0
INPUTDEVICE=/dev/video0 #video0 when webcam is not plugged in, video1 when it is
CURRENTDATE=`date +%Y%m%d-%H%M%S`
LENGTH=01:00:00
FREQUENCY=471.23
mencoder tv:// -tv freq=$FREQUENCY:chanlist=europe-west:driver=v4l2:norm=PAL:input=$INPUT:device=$INPUTDEVICE:decimation=1:quality=100:\
adevice=$SOUNDDEVICE:mjpeg:forcechan=1:fps=25:buffersize=1024:immediatemode=0:audiorate=48000 \
-vf-clr -vf pp=ci \
-mc 0 \
-ovc lavc \
-oac lavc \
-audio-preload 2 \
$LENGTH \
-lavcopts vcodec=mpeg2video:vbitrate=1200:acodec=mp2 \
-of mpeg \
-o $CURRENTDATE.mpg
The challenge seems to be that I no longer have a /dev/dsp from which mencoder can record the audio. padsp should be able to help here. All we need to do is prefix the mencoder with the padsp command and a virtual /dev/dsp appears that mencoder can read from. Sadly this doesn’t work because mencoder moans about “Not enough audio samples!” over and over. There don’t seem to be any options to change the parameters of this stream.
Another approach is adding the following lines to the ~/.asoundrc
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
With this in place you can use ffmpeg to record the audio stream:
ffmpeg -f alsa -ac 2 -i pulse audio.mp3
But I don’t see how I can get this Alsa/Pulse device into mencoder. I would very much like to record the image and audio in one go and not have to postprocess the recording and recombine both and deal with drifting sync.
Can anyone point me in the right direction?
Regards,
Richard