Inspirated

 
 

April 5, 2007

HOWTO: ALSA line-in capture with MPlayer

Filed under: Blog — krkhan @ 5:34 pm

I had an MSI TV @nywhere Plus card, and although it worked perfectly under Windows, I never got its sound working on my Linux box. The main reason for it was that the TV-Tuner card outputted sound through a separate cable to ALSA-line in. One way of getting around the mess was to launch MPlayer for video, and then capture audio through this separate command:

arecord -D hw:0 -r 44100 -c 2 -f S16_LE | aplay -

The solution wasn’t only ugly per se, but was also quite annoying because of a second’s lag in audio. After some searching in the mailing list archives of MPlayer, I combined various tricks in the following command which did the magic (relevant switches are highlighted):

mplayer -tv driver=v4l2:width=640:height=480:outfmt=i420:alsa:adevice=hw.0:
amode=2:audiorate=44100:forceaudio:immediatemode=0
:norm=PAL tv://

The adevice, amode and audiorate are dependent on your tuner card, whereas the alsa, forceaudio and immediatemode=0 are mandatory if you’re trying to capture sound from line-in.

That’s it. Now I don’t have to boot to Windows every time I want to do some video-recording. The profusion of capturing options in mencoder compared to MSI’s bundled software comes as an additional bonus for me.

Tags: , , , , , , , , , ,