$NetBSD$

--- src/xtoffmpeg.c.orig	2006-04-21 07:54:06.000000000 +0000
+++ src/xtoffmpeg.c
@@ -582,6 +582,7 @@ XImageToFFMPEG (FILE *fp, XImage *image,
     AVFormatParameters fParams, *p_fParams = &fParams;  // video stream params
     AVFormatParameters params, *ap = &params;           // audio stream params
     AVImageFormat *image_format;
+    AVPacket pkt;
     int ret, err, i;
     
     #ifdef DEBUG
@@ -1103,7 +1104,8 @@ XImageToFFMPEG (FILE *fp, XImage *image,
     #endif /* DEBUG */
     
     /* encode the image */
-    out_size = avcodec_encode_video (c, outbuf, image_size, frame);
+    av_init_packet(&pkt);
+    pkt.size = avcodec_encode_video (c, outbuf, image_size, frame);
     
 #ifdef HAVE_FFMPEG_AUDIO
     if (job->flags & FLG_AUDIO_WANTED) {
@@ -1117,7 +1119,13 @@ XImageToFFMPEG (FILE *fp, XImage *image,
     }
 #endif // HAVE_FFMPEG_AUDIO
     /* write frame to file */
-    av_write_frame (output_file, out_st->index, outbuf, out_size);
+
+    pkt.pts= c->coded_frame->pts;
+    pkt.flags |= PKT_FLAG_KEY;
+    pkt.stream_index= out_st->index;
+    pkt.data= outbuf;
+
+    av_write_frame (output_file, &pkt);
 #ifdef HAVE_FFMPEG_AUDIO
     /* release the mutex */
     if (job->flags & FLG_AUDIO_WANTED) {
