diff --git a/ffmpeg.c b/ffmpeg.c
index 11350ae4f13a72b50221b0c501f1cb7a3dc9e4dc..4e51c4d7d2460006b13c8ff9d73c1f7778ba94db 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1272,8 +1272,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
     AVFormatContext *os;
     AVOutputStream *ost;
     int ret, i;
-    uint8_t *data_buf;
-    int data_size, got_picture;
+    int got_picture;
     AVFrame picture;
     void *buffer_to_free;
     static unsigned int samples_size= 0;
@@ -1300,6 +1299,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
 
     //while we have more to decode or while the decoder did output something on EOF
     while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) {
+        uint8_t *data_buf;
+        int data_size;
     handle_eof:
         ist->pts= ist->next_pts;