Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Linux sound is generally very confusing to me, especially when two different machines running the same version of Ubuntu don't behave at all the same way.

I'm trying to use mencoder to record a video stream to an AVI file. From one of my laptops (an HP dv7) it works exactly as some random Ubuntu wiki post says it should with this command:

mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp1 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi

On another laptop (a Lenovo Ideapad U460), that fails because there's no /dev/dsp1. There's no /dev/dsp or /dev/audio anything. There is a /dev/snd directory with various cryptically-named files in it, but I have no idea which is which.

The webcam on the lenovo does work; I've tried it with Cheese. I would however like to at least understand why the systems would be different. (I have not done a side-by-side installed package comparison, I confess.)

Any suggestions on packages to install or diagnostics to perform are welcome. Thanks.

share|improve this question
    
It looks like you're trying to record from a TV source (or a webcam) and it's important that when you enable the video source that you're using the correct sound module that makes the sound part of the any video-in device work. Can you explain further about what you're trying to do? –  Martin Owens -doctormo- Nov 6 '10 at 16:26
    
Yes - record a video stream from a webcam. –  Pointy Nov 6 '10 at 17:06
add comment

1 Answer

up vote 7 down vote accepted

The problem seems to be that you're recording from a webcam and while the webcam might be the same, the sound device you're recording from isn't. So you end up with different results.

The first thing to do is to test you can record sound at all, use the sound recorded to test this and make sure to adjust the settings in System > Preferences > Sound

Once you know the sound input works, next you just need to use padsp in front of your command above, for instance:

padsp mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp1 ...

This command makes a /dev/dsp access for your command on the fly and pipes the sound via pulseaudio. See details here:

http://manpages.ubuntu.com/manpages/hardy/man1/padsp.1.html

share|improve this answer
    
Awesome that sounds like exactly the thing I needed to know. I'll try it when I have a chance and I'll come back and accept! –  Pointy Nov 6 '10 at 18:37
2  
10.10 Maverick finally disabled the very old OSS drivers (which provided /dev/dsp, so the padsp wrapper is the easiest way to handle if it you can't select ALSA or PulseAudio directly. –  Kees Cook Nov 7 '10 at 1:47
    
padsp does not work for all programs, and does not provide complete emulation. The alternative OSS proxy (ossp) is even worse. –  David Jul 5 '11 at 19:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.