You are not logged in.

#1 2010-04-11 20:59:20

Milena
Member
Registered: 2010-04-02
Posts: 67

Capture Internal Audio with ALSA

Hi

Is there a way to capture the monitor of internal audio (what i hear playing, let it be music, video, games, whatever) with ALSA ? I can only select the microphone inputs and line in in the alsamixer. I know it works great with Pulseaudio but i don't really want to install that. I have also tried OSSv4 but that didn't work at all with my Motherboards Soundchip, HDA-Nvidia,ALC1200 (snd-hda-intel is used). OSS just produces crackling sound in any application and my usb webcam is not supported either so thats no option.

Thanks in advance

Offline

#2 2010-04-11 22:50:16

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Capture Internal Audio with ALSA

If you don't want pulseaudio there's always JACK.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-04-14 12:24:18

Milena
Member
Registered: 2010-04-02
Posts: 67

Re: Capture Internal Audio with ALSA

Hi

Thanks for the reply but i don't know how jack can do that. I basically want to capture audio + video of a desktop session with ffmpeg or recordmydesktop (ffmpeg preferred), the command would be:

 ffmpeg -f alsa -i /dev/mixer -f x11grab -s 1920x1200 -r 25 -i :0.0 -sameq /tmp/out.mpg

It does record video fine but not the audio. Is there another way I can try ?

Regarding pulseaudio: Is there a pulse-patched bin32-wine package ? I kinda rely on capturing the av output of a wine application.

Offline

#4 2010-04-14 15:45:58

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Capture Internal Audio with ALSA

I use wine in a chroot, it would work fine there. I use OSS output and run with padsp though, don't like the pulse patch for wine (its ugly). Have not used ffmpeg for recording, doubt it plays with JACK.

Pulse would be your best bet.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#5 2010-04-15 09:19:38

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Capture Internal Audio with ALSA

For ALSA there is also the option to use the file writer device for recording "internal" sounds. This even works with multichannel audio (e.g. 5.1 gaming).

Note that you have to specify output filename in config file, otherwise it will not work. For example, make a file $HOME/.alsoftrc with two lines:

[wave]
file = /tmp/output.wav

I've sucessfully tested this with UT2k4 but the wave file writer puts heavy load to your system. So expect some serious slow downs if you want to record gaming sound with this.

For more details check:
http://www.alsa-project.org/alsa-doc/al … lugins.html
http://www.alsa-project.org/main/index.php/Asoundrc

Edit: OpenAL also supports writing for wave devices:
http://vrmlengine.sourceforge.net/openal_notes.php
Some soundcards feature a "mix" channel which you could also use for recording internaly played back sound.

Last edited by Darksoul71 (2010-04-15 09:30:29)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#6 2010-04-15 09:53:18

Milena
Member
Registered: 2010-04-02
Posts: 67

Re: Capture Internal Audio with ALSA

Thanks again.

I setup Pulseaudio now but padsp and oss output in winecfg does not work for any game or application:

ERROR: ld.so: object 'libpulsedsp.so' from LD_PRELOAD cannot be preloaded: ignored.

No sound at all.

Offline

#7 2010-04-15 14:10:12

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Capture Internal Audio with ALSA

The other option would be using simple hardware. Sorry if the following links go to german websites but hopefully you understand the purpose and my explanation neutral

1) Plug in a headset "y-plug" like this:
http://cgi.ebay.de/Adapter-Y-Stecker-2x … 0394090450

2) Plug in your headset / speakers in one jack.

3) Plug in a cable like this to the other "audio output":
http://cgi.ebay.de/Stereo-Kabel-3-5-mm- … 3efcf1c3a8

4) Plug the other side of this cable into the line in of your sound card used for playback or into another soundcard (e.g. a cheapo USB card).

If you sound card does not have a line in it's possible to build a cheap adapter for pluggin line sources into mic input.
Have a closer look here:
http://www.epanorama.net/circuits/line_to_mic.html

The rest should be pretty straightforward since you can configure Audacity to record from any soundsource available in the system.

Last edited by Darksoul71 (2010-04-15 14:11:59)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#8 2010-04-15 20:04:23

Milena
Member
Registered: 2010-04-02
Posts: 67

Re: Capture Internal Audio with ALSA

Thanks Darksoul smile

I can read the german text, no problem. It does work but its a bad solution in my opinion, quality wise a big loss to go over analog cables to loop the signal back. This is actually one of the few things where Pulseaudio shines. I think the best way now would be a proper chroot setup to use the patched wine package. Can OSSv4 actually record the what-you-hear audiomix ? If so I might give it another try some time.

Offline

#9 2010-04-15 20:19:00

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Capture Internal Audio with ALSA

Milena wrote:

Thanks Darksoul smile

You are welcome ! Agreed ! Its not the smartest approach but I wouldn't consider the quality loss being too big. At least if you have a good sound card. Even most "HDA" onboard sound cards nowadays produce good quality.

In regard to pulseaudio I would try to completely stay away of it. It can cause bad latencies. Esp. for gaming. In fact pulseaudio is the main reason for me to quit using ubuntu since its becoming more and more the central "sound system" used by Ubuntu without the build-in option to remove it. roll

In regard to the chrooted wine I think it can really be a pain in the neck to get working 3d in the 32 bit subsystem.

Last edited by Darksoul71 (2010-04-15 20:20:10)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#10 2010-04-16 03:42:33

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Capture Internal Audio with ALSA

Milena wrote:

Thanks again.

I setup Pulseaudio now but padsp and oss output in winecfg does not work for any game or application:

ERROR: ld.so: object 'libpulsedsp.so' from LD_PRELOAD cannot be preloaded: ignored.

No sound at all.

Does your chroot have pulse installed, and is it setup according to the wiki on Pulseaudio?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#11 2010-04-16 11:35:55

Milena
Member
Registered: 2010-04-02
Posts: 67

Re: Capture Internal Audio with ALSA

ngoonee wrote:

Does your chroot have pulse installed, and is it setup according to the wiki on Pulseaudio?

bin32-wine here. I have no 32 bit chroot, i read the wiki about it and it looks very complicated to setup (i.e. full 3D capabilities etc.), maybe not worth just for wine. Is there any major advantage to use chroot wine over the bin32 ? I may try it this weekend if i got time.

Offline

#12 2010-04-16 13:31:02

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Capture Internal Audio with ALSA

Hm, to me it seems that a 32 bit chroot is the "only" solid approach to run 32 bit apps under arch.
While I never had issues with 32 bit wine together with 32 "compatibility libs" under Sidux and Ubuntu, it seems that arch is more sensitive than other distribs here or may be cleaner ?

Example: Crossover games (32 bit) crashes under arch x86_64 when I try to register my version. bin32-wine failed yesterday when installing DeusEx and Starcraft. Both games gave me errors indicating that my opengl driver might not be correctly installed. Since I can play UT2k4 natively with my radeon HD4670 this does not seem to be true. And I can confirm that both games run fine under WINE since they are installed on my other Ubuntu 9.04 host as well big_smile

To me setting up the chroot as describe in the wiki is straightforward and does not take more than 10 minutes to setup.
I'll try out to get running 3D under the 32 bit chroot and report tomorrow how it worked. Eventually (if things work) I'll write a short segment for the Wiki to discribe how to get working 3D inside the chroot and how to start windows games inside the chroot from your 64 bit arch via shell script. Have a look at my other post here:
http://bbs.archlinux.org/viewtopic.php?id=95406

Have a nice weekend,
D$

Last edited by Darksoul71 (2010-04-16 13:31:59)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#13 2010-04-17 15:25:00

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Capture Internal Audio with ALSA

Milena wrote:
ngoonee wrote:

Does your chroot have pulse installed, and is it setup according to the wiki on Pulseaudio?

bin32-wine here. I have no 32 bit chroot, i read the wiki about it and it looks very complicated to setup (i.e. full 3D capabilities etc.), maybe not worth just for wine. Is there any major advantage to use chroot wine over the bin32 ? I may try it this weekend if i got time.

Well, for me, the single major advantage I always quote is this:-

When you're using lib32, you're relying on USERS to update your libraries. They will ALWAYS be behind the repos, so when a library updates your wine installation won't work until the user notices and updates. In addition, every single library Wine needs will need to be compile from the AUR.

When you're using the chroot, you're using the binary packages the devs/TUs are maintaining. When your 64-bit install has an update, the corresponding 32-bit lib/package has updated in exactly the same way.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#14 2010-08-11 21:11:28

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Capture Internal Audio with ALSA

Hi Milena,

sorry for digging up this old thread but may be I found a solution which also works for you. Just for curiosity I played around with ffmpeg's X11 capture abilities in order to record game videos in good quality with sound smile

Similar to you I am using ALSA as sound system and personally completely dislike pulseaudio (but that's a different story).

Unfortunately ffmpeg also completely failed to record the sound for me. rec (from the SOX package) did so very well. So I decided to use rec for recording the sound and ffmpeg for capturing the video part.

After a few experiments I hacked together this nasty shell script:

/usr/bin/rec ~/t_game.wav -V0 &
/usr/bin/ffmpeg -f x11grab -y -r 15 -s 688x544  -i :0.0 -vcodec huffyuv ~/t_game.avi
# Do a hard kill for rec after ffmpeg's X11 recording session has ended
killall /usr/bin/rec
/usr/bin/mencoder -ovc copy -oac copy -audiofile ~/t_game.wav -o ~/game.avi ~/t_game.avi
rm ~/t_game.avi
rm ~/t_game.wav

Usage:
After start of rec in the background I usually start the game. After finishing my recording I stop ffmpeg by focusing the shell windos and pressing q. Muxing audio and video takes a while with mencoder.

I prefer huffyuv for video capturing because it's lossless and does not put a lot of stress to the CPU. The only thing I have to do in order to get sound is to raise the level of a mixer called wave in the recording section of the AlsaMixer. My sound card is an old SB Live (emu10k1 chip). Oh yes, the area I grab is taylored for a game window of 640x480 moved to the left corner of your screen.

I find the result promising if you keep in mind that I use the radeon open source driver (which is not that fast) and have a fairly slow CPU. You might want to have a short look at the video I recorded this way from my favourite coop mod called Kleshik:
http://www.youtube.com/watch?v=-j5-Q5AirXQ

Edit:
UT2k4 video is now uploaded as well:
http://www.youtube.com/user/darksoul71# … 38lfx0IOWY

BTW: Here are two other links related to screencapturing I liked as well:
http://wiki.audacityteam.org/wiki/Recor … e_computer
http://verb3k.wordpress.com/2010/01/26/ … -on-linux/

HTH,
D$

Last edited by Darksoul71 (2010-08-12 11:44:35)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

Board footer

Powered by FluxBB