Getting ALSA Pd~ into FFmpeg

I set up a fresh PatchboxOS, and I’m running a PureData patch that generates audio. Everything seems fine, it’s playing audio out of the headphone jack no problem.

I’ve compiled ffmpeg from source

Listing my sources returns the following:

$ ffmpeg -sources alsa
Auto-detected sources for alsa:
* default [Playback/recording through the PulseAudio sound server]
  null [Discard all samples (playback) or generate zero samples (capture)]
  jack [JACK Audio Connection Kit]
  pulse [PulseAudio Sound Server]
  usbstream:CARD=ALSA [USB Stream Output]

My ffmpeg script for good measure:

ffmpeg \
  -re \
  -f alsa \
  -i default \
  -stream_loop -1 \
  -re \
  -i loop.mp4 \
  -shortest \
  -ar 44100 \
  -c:v copy \
  -c:a aac \
  -f flv "$URL"

This all works fine, except no audio. I’ve tried every permutation that I can think of, but I must not be understanding something.

Questions/Notes:

  1. Does anything else need to be pre-configured? Patchage?
  2. Pd: Media > ALSA logs ALSA input error (snd_pcm_open): No such file or directory
  3. Is -f alsa -i default correct?

Any pointers would be huge, thank you!

Hey, you should use Jack backend with audio software on Patchbox OS (if such option is available), then the audio hardware is shared with all software. Otherwise, if using ALSA, every software usually takes exclusive access to audio hardware, and errors like these start to happen, especially “device is busy” errors.

It looks like it does have Jack as an option from your pasted commands, so you should try with that, then you should be able to see ffmpeg appear in the Patchage to hook it up to system output as necessary.