LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-18-2019, 02:12 AM   #1
sergiomarina
LQ Newbie
 
Registered: Jan 2019
Posts: 3

Rep: Reputation: Disabled
cannot open audio device plughw:0,0 (Device or resource busy)


ARMBIAN 5.65 stable Debian GNU/Linux 9 (stretch) 4.14.84-sunxi

Linux orangepizero 4.14.84-sunxi #3 SMP Sat Dec 1 07:18:41 CET 2018 armv7l GNU/Linux

vailla@orangepizero:~$ ffmpeg -f alsa -ac 1 -ar 8000 -i plughw:0,0 -map 0:0 -codec:a libmp3lame -qscale:a 2 -f segment -strftime 1 -segment_time 600 -segment_atclocktime 1 Ch33_%Y-%m-%d_%H-%M-%S.mp3 -nostdin -nostats </dev/null >output33.log 2>&1 &
[1] 4472
vailla@orangepizero:~$ ffmpeg -re -f alsa -i plughw:0,0 -acodec libmp3lame -ab 32k -ac 1 -f rtp rtp://234.4.10.5:50003
[alsa @ 0xca65d0] cannot open audio device plughw:0,0 (Device or resource busy)
plughw:0,0: Input/output error

My goal:
I want ALSA to stably capture audio to a file and, at the same time, to stream audio on demand.
Note:
- If the ALSA is not kept busy by the audio capture to a file the rtp audio stream works flawlessly.
- The error "resource busy" is clear to me and I understand that.

My question:
Is there a solution to address my goal? In that case how to?

Thank you a lot for the help!

Last edited by sergiomarina; 01-18-2019 at 10:27 PM. Reason: make clearer my question
 
Old 01-18-2019, 01:57 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
not with alsa.
(well, i did manage once by plugging a cable into audio OUT, and then back into line IN)

you need pulseaudio or jackaudio.

some magicians apparently managed this with alsa too, but the knowledge is lost in the mist of the ages...
 
1 members found this post helpful.
Old 01-18-2019, 10:23 PM   #3
sergiomarina
LQ Newbie
 
Registered: Jan 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
thank you.
So you mirrored the MIC into LINE OUT in order to make it seem LINE IN is an new source and stream it separately.
Am I correctly understanding??

Question (which is barely related, but I want to take the chance of your experience):
my ALSA produces some loud noises periodically. Let's say every minute and for about a second.
I hear those noises connecting a loudspeaker to LINE OUT, even if the system is idle and not performing any user related task.
I hear those noises even in the recorded files.
Did you experience a similar issue? In that case, how did you manage it? (I have tested different power supplies with no effects)


PS: based on my previous test on same system (orange pi zero), where I have installed pulseaudio, I prefer to use just ALSA. Am I just a newbie or pulseaudio could really limit the system stability? If so I think I'll solve with a quick and dirty workaround: two separate orange pi (or similar SBC) systems. BTW my d-link camera performs simultaneous recording and streaming on demand.

Last edited by sergiomarina; 01-18-2019 at 10:25 PM.
 
Old 01-19-2019, 01:47 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by sergiomarina View Post
my ALSA produces some loud noises periodically. Let's say every minute and for about a second.
I hear those noises connecting a loudspeaker to LINE OUT, even if the system is idle and not performing any user related task.
I hear those noises even in the recorded files.
Did you experience a similar issue?
never.
sounds like a serious problem.
I wouldn't even know how to troubleshoot that - maybe have a look at these results.
could it be orangepi specific?

Quote:
based on my previous test on same system (orange pi zero), where I have installed pulseaudio, I prefer to use just ALSA. Am I just a newbie or pulseaudio could really limit the system stability?
i think you're really just a newbie.
pulseaudio is generally stable, and shouldn't take too many resources either (i don't know how powerful orangepi is).
 
Old 01-20-2019, 05:22 AM   #5
sergiomarina
LQ Newbie
 
Registered: Jan 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
In the attached screen shot the noise waveform as shown by the audio editor.
I think the orange pi produces that noise since:
1) I can hear the noise even if alsa line out is muted
2) no noise if the loudspeaker jack is unplugged

Unfortunately *.wav file can't be attached. You can image the noise as a metallic item (like a screwdriver or a fork) scraping a rough concrete surface.
It must be a HW problem. Therefore could be either orange pi specific or just a defective sample.
As I said I have already tested two different power supplies w/o changes.

To perform audio streaming, have you tested clvc instead of ffmpeg? I do not think it'll solve the "Device or resource busy" issue, but it could be worth a try.
Attached Thumbnails
Click image for larger version

Name:	NoisePeriodicity.jpg
Views:	66
Size:	35.1 KB
ID:	29522  
 
Old 01-20-2019, 06:36 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
the noise seems to come in very regular intervals.
that might give you a hint as to what's going on.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] QSSTV no audio error:Unable to open hw:0,0 ALC662 rev1 Analog: Device or resource busy unclejed613 Ubuntu 0 04-17-2018 12:45 AM
[SOLVED] mdadm: cannot open /dev/sdc1: Device or resource busy sibleytr Linux - Hardware 3 07-21-2015 11:12 PM
mkfs cannot open <device>: Device or resource busy maccas17 Fedora 3 11-14-2013 01:38 PM
cannot open /dev/modem: device or resource busy qazwsx27 Linux - Hardware 8 10-04-2008 02:01 PM
Can't open audio device. Device or resource busy. deepumnit Linux - Software 2 06-16-2008 09:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration