diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 041617aff35c51d00c0066497ff400b65ce435cd..d4dac5cd692fb4167450ab296aa70bf86ccdb40b 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -493,12 +493,12 @@ static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
     AVCodecContext *c;
     AVFrame *frame;
     int got_packet = 0;
+    AVPacket pkt = { 0 };
 
     c = ost->st->codec;
 
     frame = get_video_frame(ost);
 
-    AVPacket pkt = { 0 };
     av_init_packet(&pkt);
 
     /* encode the image */