[FFmpeg-user] Reading or writing audio from audio device on MacOS

DopeLabs dopelabs at dubstep.fm
Sat May 9 18:31:26 EEST 2020



> On May 9, 2020, at 7:21 14AM, Michael Glenn Williams <michael.glenn.williams at smartblondeco.com> wrote:
> 
> Hi All,
> 
> Is it possible to ask ffmpeg to read or write from/to an audio device on
> MacOS? For example read from the microphone or playback to headphones?

yes, you can use avfoundation. to get a list of input devices use the following command

ffmpeg -f avfoundation -list_devices true -i ""

that will provide you with a list of video and audio input devices...

input devices are specified by the ID number separated by a colon provided in the previous command.

you specify the devices as -i "videoid:audioid"

here is an example of what mine looks like:

[AVFoundation indev @ 0x7fc3d1703980] AVFoundation video devices:
[AVFoundation indev @ 0x7fc3d1703980] [0] CamTwist
[AVFoundation indev @ 0x7fc3d1703980] [1] FaceTime HD Camera (Built-in)
[AVFoundation indev @ 0x7fc3d1703980] [2] webcamoid
[AVFoundation indev @ 0x7fc3d1703980] [3] CamTwist (2VUY)
[AVFoundation indev @ 0x7fc3d1703980] [4] EpocCam
[AVFoundation indev @ 0x7fc3d1703980] [5] Capture screen 0
[AVFoundation indev @ 0x7fc3d1703980] [6] Capture screen 1
[AVFoundation indev @ 0x7fc3d1703980] [7] Capture screen 2
[AVFoundation indev @ 0x7fc3d1703980] AVFoundation audio devices:
[AVFoundation indev @ 0x7fc3d1703980] [0] Scarlett 18i20 USB
[AVFoundation indev @ 0x7fc3d1703980] [1] Built-in Microphone
[AVFoundation indev @ 0x7fc3d1703980] [2] EpocCam Microphone
[AVFoundation indev @ 0x7fc3d1703980] [3] aux1 


for example if i want to do a screen capture of screen 1 for the video and the built in mic for the audio, the command would look like this

ffmpeg -f avfoundation -i "6:1"

if i only want audio

ffmpeg -f avfoundation -i ":1"

im pretty sure that avfoundation is strictly input devices only... that being said, you could probably pipe it to ffplay if you wanted to monitor local playback, in which it would use the system configured output device.

there are other 3rd party tools you can use to route specific application audio output such as loopback or audiohijack.

cheers =]

> 
> Thank you!
> 
> -- 
> <https://meetings.hubspot.com/michael-glenn-williams> Michael Williams
> 
> CEO | CTO
> 
> Smart Blonde Experiential
> 8054991994
> michael.glenn.williams at smartblondeco.com
> totalvu.tv
> 13900 Marquesas Way, Marina Del Rey, CA
> <http://totalvu.tv>
> [image: facebook]
> <https://www.facebook.com/boldstream/app/128953167177144/> [image:
> twitter] <https://twitter.com/smartblondecorp> [image: linkedin]
> <https://www.linkedin.com/in/michaelglennwilliams/>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list