5

How can I determine whether the internal microphone of my laptop is used or not in one single command?

Example:

The output of the command should be different once a ffmpeg capture is run:

ffmpeg -f alsa -ac 2 -i plughw:0,0 recording.mp4
1

1 Answer 1

6

Look into /proc/asound/card0/pcm0p/sub0/status; it's either

closed

or something like

state: RUNNING
owner_pid   : 6371
trigger_time: 51690.093652120
tstamp      : 0.000000000
delay       : 51156
avail       : 210988
avail_max   : 229376
-----
hw_ptr      : 79916
appl_ptr    : 131072
1
  • To expand on this, to check all microphones: find /proc/asound -name status -exec grep -v closed {} + If there's any output, a microphone is in use. If there's no output, no microphones are in use. (Possibly the find should be narrowed down a bit, but this is at least a starting point!) Jun 3, 2023 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .