Fedora Linux Support Community & Resources Center
  #1  
Old 19th November 2007, 05:29 AM
fozner Offline
Registered User
 
Join Date: Aug 2005
Posts: 163
A/V and/or microphone recording on Fedora8 somewhat crippled (

My needs are simple. I would like to record audio from the command line. The problem: I use Fedora 8, with pulseaudio enabled by default. None of the populare alsa/oss recording tools work. So far, I have tried:

arecord -Dpulse -t wav this.wav
streamer -t 0:30 -O soundtrack.wav -F stereo
oss: open /dev/dsp: Device or resource busy
padsp streamer -t 0:30 -O soundtrack.wav -F stereo
oss: open /dev/dsp: Device or resource busy
ffmpeg -f audio_device -i /dev/dsp -f x11grab -s vga -i :0.0+10,20 out.mpg
/dev/dsp: Device or resource busy
padsp ffmpeg -f audio_device -i /dev/dsp -f x11grab -s vga -i :0.0+10,20 out.mpg
(resultant file is corrupt)
ecasound -i alsahw,0,1 -o test.wav
(records blank test.wav)
padsp ecasound -i /dev/dsp -o test.wav
(blocks/hangs)

Audacity works, but alas, audacity is not a command-line tool.

Last edited by fozner; 19th November 2007 at 09:22 PM. Reason: Better title
Reply With Quote
  #2  
Old 19th November 2007, 08:33 AM
Dangermouse Offline
Administrator - (On Leave)
 
Join Date: Aug 2007
Location: London Postbox (the red one)
Age: 48
Posts: 3,864
Have you tried
arecord -f cd -t raw | lame -x - out.mp3
Reply With Quote
  #3  
Old 19th November 2007, 08:34 AM
Dangermouse Offline
Administrator - (On Leave)
 
Join Date: Aug 2007
Location: London Postbox (the red one)
Age: 48
Posts: 3,864
Sorry of course you need lame installed as well
Quote:
yum install lame
Reply With Quote
  #4  
Old 19th November 2007, 07:45 PM
fozner Offline
Registered User
 
Join Date: Aug 2005
Posts: 163
Thanks, I'll try that. I also did not think to try disabling pulseaudio with (I think*) pulseaudio -k and then re-enabling it with pulseaudio -D after I'm done playing around. When things aren't so busy around here I"ll give it a shot.

Edit: Nope! Didn't work. Also tried disabling pulseaudio but it makes things worse. So does removing alsa-plugins-pulseaudio-1.0.14-5.fc8.x86_64.rpm. It appears that recording audio from the command line is impossible without completely removing all pulseaudio packages --nodeps which is, shall we say, inconvenient.

Why this functionality is wanted: Originally, I was going to do some desktop session recording with ffmpeg -X11grab (X11grab is unavailable in the rpm version of ffmpeg. I had to compile it special for that.) Anyway, it would be convenient if I could record audio and video together instead of recording them separately and then merging them together with avidemux, paying particular attention to syncing them correctly. Perhaps I am asking too much and should go back to playing super tux cart.

Last edited by fozner; 19th November 2007 at 09:09 PM.
Reply With Quote
  #5  
Old 21st November 2007, 12:13 AM
fozner Offline
Registered User
 
Join Date: Aug 2005
Posts: 163
Lightbulb

Through trial and error, I was eventually able to record form the mic using the following command. Interestingly, it only works 50% of the time. The other 50% of the time results in a blank (no noise) audio file of the same length.

arecord -v -Dplughw:0,2 -N -d 10 -r48k -c2 this.wav

Later on, I learned that I could enumerate the available capture devices with aplay -l
Code:
aplay-l | grep card
card 0: Live [SBLive! Value [CT4871]], device 0: emu10k1 [ADC Capture/Standard PCM Playback]
card 0: Live [SBLive! Value [CT4871]], device 2: emu10k1 efx [Multichannel Capture/PT Playback]
card 0: Live [SBLive! Value [CT4871]], device 3: emu10k1 [Multichannel Playback]
You can see how card 0: device 2 translates into hw:0,2 but pulseaudio is using hw:0,2 so it appears busy. That's why I had to use plughw:0,2
And to make it the default recording device, I modified .asoundrc in my home directory:
Code:
pcm.pulse {
	type pulse
 }
pcm.!default {
 type asym
	playback.pcm "pulse"
	capture.pcm "plughw:0,2"
 }
 ctl.!default {
	type pulse
 }
Now simple commands like "arecord -d 5 this.wav" work as expected but... is it a hack?

Last edited by fozner; 21st November 2007 at 03:43 AM.
Reply With Quote
  #6  
Old 21st November 2007, 02:41 AM
kadambi Offline
Registered User
 
Join Date: Oct 2007
Posts: 120
Not sure if this'd help but give this a try:

Have you set sound capture preferences to ALSA?

System ->Preferences->Hardware->Sound
__________________
----------------------------------------------------
F9
MB: ASUS M2A-VM HDMI AMD 690G microATX
Processor: AMD 64 X2 6000+ 3GHz
Memory: CorsAir PC6400 800MHz, 4GB
HDD: Samsung 250 GB SATA HDD
ATI X1950Pro PCIe (Running Xorg Radeon)
Reply With Quote
  #7  
Old 21st November 2007, 03:37 AM
fozner Offline
Registered User
 
Join Date: Aug 2005
Posts: 163
Red face

Yes but those settings seem to be for gnome apps. They don't seem to affect command line tools like arecord or other window managers like xfce, kde...

Hmm, my hack bypasses pulseaudio completely for recording purposes, which is ok for me I guess, since I'm not using thin clients or anything network audio. It would be better if I knew enough to tell pulseaudio what to do.

Edit: I'm starting to get a clue. I'm seeing stuff in the logs when pulseaudio starts up. Yup, this is why I couldn't record: I think I can figure it out now. :O

Nov 20 18:48:45 arrgh pulseaudio[4243]: module-alsa-source.c: Error opening PCM device hw:0: Device or resource busy
Nov 20 18:48:45 arrgh pulseaudio[4243]: module.c: Failed to load module "module-alsa-source" (argument: "device=hw:0 source_name=alsa_input.pci_1102_2_alsa_capture_0") : initialization failed.

It is because hotplug trying to load the same device twice. http://www.pulseaudio.org/ticket/128

Last edited by fozner; 21st November 2007 at 03:59 AM.
Reply With Quote
  #8  
Old 21st November 2007, 05:26 AM
fozner Offline
Registered User
 
Join Date: Aug 2005
Posts: 163
My latest hack involves looking at the output of aplay -l and adding the card (0 in my case) and input device (2 in my case) right after plughw in the following line in /etc/pulse/default.pa.
Code:
add-autoload-source input module-alsa-source device=plughw:0,2 source_name=input
And then I run padevchooser tray icon, change default source to "input". My mic now works and is more or less correctly controlled by pulseaudio, but there are still errors in the log???

W: alsa-util.c: Device plughw:0,2 doesn't support 44100 Hz, changed to 48000 Hz.
ALSA lib control.c:909snd_ctl_open_noupdate) Invalid CTL plughw:0,2
W: alsa-util.c: Unable to attach to mixer plughw:0,2: No such file or directory
Reply With Quote
Reply

Tags
audio, command, line, record

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
(cmd line) record to a cd grimx Using Fedora 5 17th May 2008 08:50 PM
(cmd line) record to a cd grimx Using Fedora 1 17th May 2008 05:56 PM
How to record streaming audio? vasim98 Using Fedora 9 25th November 2006 09:34 PM
audio record distortion PeterJP Using Fedora 3 16th September 2005 03:15 PM


Current GMT-time: 03:59 (Friday, 25-04-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat