0

I recently got a four-channel USB input device (Behringer UMC404HD). The device is working and Linux sees it; I know this because I can record four independent channels using Audacity. However, I can't work out how to ask ffmpeg to do the same thing.

If I configure ALSA and issue this command:

ffmpeg -f alsa -i pulse  test.flac

I get a stereo file that contains sound from the multichannel device that is all four channels mixed down to stereo (it's treating it as a front and rear quadraphonic source).

ffprobe on that file reports (among the mass of other info):

Stream #0:0: Audio: flac, 48000 Hz, stereo, s16

Try as I might I cannot seem to determine how to put this thing into quad mode, rather than stereo. This page looked promising, but I couldn't make any of it work for my (surely much simpler!?) case: https://trac.ffmpeg.org/wiki/AudioChannelManipulation

Anyone know how I should do this? It seems like it should be a trivial thing, and I'm probably just using the wrong words in my searches.

4
  • I don't know for certain, but in this day & age quad audio is so rare that you might be better trying to format it as 5.1 with 2 empty channels.
    – Tetsujin
    Commented Oct 13, 2018 at 16:36
  • 2
    The issue here has to be addressed on the input side; rematrixing the input to 4 channels won't get you your input if ffmpeg hasn't ingested them in the first place. See the docs for alsa options.
    – Gyan
    Commented Oct 13, 2018 at 16:49
  • Tetsujin, I don't care what format it is, so long as it has four independent channels (they're not positional, they're effectively independent instruments/voices anyway). So, if you can tell me how to build a command line that does what you suggest, that'd be perfectly useful. Commented Oct 14, 2018 at 4:02
  • Gyan, thanks, that eventually led me to a solution. It took a few tries to work out how to use the channels feature, and where to put it, and then to discover that a flac container isn't suitable for four channels (or at least ffmpeg says so) But in the end, this worked: ffmpeg -f alsa -channels 4 -i pulse test.wav It seems to be important that the -channels comes before -i pulse, and a wav container seems like it wastes disk space, but at least it holds four channels without a problem. Many thanks. Commented Oct 14, 2018 at 4:14

1 Answer 1

1

You should signal the correct number of channels on the input side, and for storing in FLAC, you will need to set a supported channel layout. So,

ffmpeg -f alsa -channels 4 -i pulse -channel_layout quad test.flac
2
  • Thanks, one of the things I find hardest to discover about ffmpeg is the syntax of the commands. It seems to be critically order sensitive, and I've not yet found (in the huge pile of docs!) the part where that's described in general terms. Anyway, your input has clarified nicely. Commented Oct 15, 2018 at 15:54
  • See last two paras of this section: ffmpeg.org/ffmpeg.html#Description
    – Gyan
    Commented Oct 15, 2018 at 16:03

You must log in to answer this question.

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