From e663030267851e0e0be54dc9d685fa9cd883cef6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 20 Jan 2022 16:56:53 +0100 Subject: [PATCH] lavc/encode: pick a sane default for bits_per_raw_sample if it's not set Fixes #9563. --- libavcodec/encode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 85b8e089dd..6ae47b736c 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -555,6 +555,9 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif + if (!avctx->bits_per_raw_sample) + avctx->bits_per_raw_sample = 8 * av_get_bytes_per_sample(avctx->sample_fmt); + return 0; }