I am using ffmpeg to read and write raw audio to/from my python script. Both the save and load commands I use produce the warning "Guessed Channel Layout for Input Stream #0.0 : mono"? This is despite that fact that I am telling ffmpeg using -ac 1
before both the input and output that there is only one channel. I saw some other answers where I should set -guess_layout_max 0
but this seems like a hack since I don't want ffmpeg to guess; I am telling it exactly how many channels there are with -ac 1
. It should not need to make any guess.
My save command is formatted as follows with r
being the sample rate and f
being the file I want to save the raw audio to. I am sending raw audio via stdin from python over a pipe.
ffmpeg_cmd = 'ffmpeg -hide_banner -loglevel warning -y -ar %d -ac 1 -f u16le -i pipe: -ac 1 %s' % (r, shlex.quote(f))
Likewise my load command is the following with ffmpeg reading from f
and writing raw audio to stdout.
ffmpeg_cmd = 'ffmpeg -hide_banner -loglevel warning -i %s -ar %d -ac 1 -f u16le -c:a pcm_u16le -ac 1 pipe:' % (shlex.quote(f), r)
-ac
sets no. of channels, not their layout, of which there can be multiple for each value of a channel count.
Use the option -channel_layout
.
ffmpeg -hide_banner -loglevel warning -y -ar %d -ac 1 -channel_layout mono -f u16le -i pipe: ...