diff -ru mplayer-38542.orig/libmpcodecs/ae_lavc.c mplayer-38542/libmpcodecs/ae_lavc.c
--- mplayer-38542.orig/libmpcodecs/ae_lavc.c	2026-08-05 19:55:27.791172070 +0200
+++ mplayer-38542/libmpcodecs/ae_lavc.c	2026-08-05 19:57:05.618558825 +0200
@@ -177,10 +177,12 @@
 	lavc_actx->codec_id = lavc_acodec->id;
 	// put sample parameters
 	lavc_actx->sample_fmt = AV_SAMPLE_FMT_S16;
-	if (lavc_acodec->sample_fmts) {
+	const enum AVSampleFormat *codec_sample_fmts = NULL;
+	avcodec_get_supported_config(NULL, lavc_acodec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, (const void**)&codec_sample_fmts, NULL);
+	if (codec_sample_fmts) {
 		const enum AVSampleFormat *fmts;
-		lavc_actx->sample_fmt = lavc_acodec->sample_fmts[0]; // fallback to first format
-		for (fmts = lavc_acodec->sample_fmts; *fmts != AV_SAMPLE_FMT_NONE; fmts++) {
+		lavc_actx->sample_fmt = codec_sample_fmts[0]; // fallback to first format
+		for (fmts = codec_sample_fmts; *fmts != AV_SAMPLE_FMT_NONE; fmts++) {
 			if (samplefmt2affmt(av_get_packed_sample_fmt(*fmts)) == encoder->params.sample_format) { // preferred format found
 				lavc_actx->sample_fmt = *fmts;
 				break;
