diff --git a/ffserver_config.c b/ffserver_config.c
index 14c58cebb5ec04fe0fefc5f8466078b52fbabc24..2354cc7dc0417a12aefb96c8003017445714677a 100644
--- a/ffserver_config.c
+++ b/ffserver_config.c
@@ -320,6 +320,8 @@ done:
     av_dict_free(&recommended);
     st->recommended_encoder_configuration = enc_config;
     st->codec = av;
+    st->codecpar = avcodec_parameters_alloc();
+    avcodec_parameters_from_context(st->codecpar, av);
     stream->streams[stream->nb_streams++] = st;
 }