diff --git a/libavformat/utils.c b/libavformat/utils.c
index a12f26afd78496174bf04cf882e66e60ccfb6468..95abbe2d642bc1f4853d645e023a059e28ce0b58 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1694,7 +1694,7 @@ static int has_codec_parameters(AVCodecContext *enc)
     int val;
     switch(enc->codec_type) {
     case CODEC_TYPE_AUDIO:
-        val = enc->sample_rate;
+        val = enc->sample_rate && enc->channels;
         break;
     case CODEC_TYPE_VIDEO:
         val = enc->width && enc->pix_fmt != PIX_FMT_NONE;