[FFmpeg-devel] [PATCH 3/3] lavc/encode: pick a sane default for bits_per_raw_sample if it's not set

Martijn van Beurden mvanb1 at gmail.com
Thu Jan 20 20:58:54 EET 2022


Op do 20 jan. 2022 om 17:05 schreef Anton Khirnov <anton at khirnov.net>:

> Fixes #9563.
> ---
>  libavcodec/encode.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/encode.c b/libavcodec/encode.c
> index b6f81d1458..44ab81af3f 100644
> --- a/libavcodec/encode.c
> +++ b/libavcodec/encode.c
> @@ -535,6 +535,9 @@ static int encode_preinit_audio(AVCodecContext *avctx)
>          return AVERROR(EINVAL);
>      }
>
> +    if (!avctx->bits_per_raw_sample)
> +        avctx->bits_per_raw_sample = 8 *
> av_get_bytes_per_sample(avctx->sample_fmt);
> +
>      return 0;
>  }
>

This creates a new regression: now 24-bit WAV files are converted to 32-bit
WavPack files. I think I found the cause of the problem though: the issue
is that wavpack uses sample format s32p and 24-bit wav files use s32.
Therefore, a aresample filter is auto-inserted to convert s32p to s32,
which causes ost->filter->graph->is_meta to be false.


More information about the ffmpeg-devel mailing list