[FFmpeg-user] Audio sample format in alsa?

Simon Roberts simon at dancingcloudservices.com
Wed Jul 1 17:56:40 EEST 2020


On Wed, Jul 1, 2020 at 5:00 AM Nicolas George <george at nsup.org> wrote:

> Simon Roberts (12020-06-30):
> > I get:
> > [alsa @ 0x55ac7254fd80] cannot set sample format 0x10000 2 (Invalid
> > argument)
> > hw:1,0: Input/output error
>
> This message could be made better. This is s16le, which should be the
> most common format, but we never know.
>

Interesting. Yes, when I (as you suggested below) use the plughw, it does
indeed record in 16le, but even setting this manually, still rejects. Ah
well.


> > But I'm not sure where to start with configuring this sample format. Can
> > someone point me in the right direction? I didn't find much in the alsa
> > section of the online manual.
>
> ALSA can be tricky. I suggest you try first to use the card with aplay,
> fiddling with -f to find what format it supports. And then, when it
> works, transpose this into ffmpeg options.
>
> Or you could let ALSA make automatic conversions by using plughw instead
> of hw.
>

Magic! plughw:1,0 works a treat. Are there any limitations, or caveats,
that I should be aware of? Is this a risk or tradeoff of any sort? I note
that the recording seems to be 16le, so I have no immediate evidence of it
being in any way less than optimal, but since I'm afraid I had never come
across this, I don't know what I don't know.

Many thanks!
Simon


More information about the ffmpeg-user mailing list