A required bit depth of 16 will break conversion to ALAC, and a bit depth of 24 will break conversion to FLAC, due to ALAC only supporting planar formats (but 16-bit conversion passes a non-planar format) and FLAC only supporting non-planar formats (but 24/32-bit conversion passes a planar format) https://github.com/nathom/streamrip/issues/615
This can be fixed by refactoring lossless conversion to always pass an aformat filter, containing sampling rate and/or bit depth (whereas previously only the sampling rate was in an aformat filter). This allows us to pass a list of bit depths; so not only can we specify both planar and non-planar formats (so ffmpeg can simply pick whichever applies to the specified codec), but if a list of bit depths is specified then ffmpeg won't use a bit depth higher than that of the source file.
When converting to a lossless codec, there are two issues relating to the bit depth:
This can be fixed by refactoring lossless conversion to always pass an
aformat
filter, containing sampling rate and/or bit depth (whereas previously only the sampling rate was in anaformat
filter). This allows us to pass a list of bit depths; so not only can we specify both planar and non-planar formats (so ffmpeg can simply pick whichever applies to the specified codec), but if a list of bit depths is specified then ffmpeg won't use a bit depth higher than that of the source file.