[FFmpeg-devel] fix case where audio codec doesn't return a full packet

Art Clarke aclarke
Wed Feb 18 02:44:51 CET 2009


On Mon, Feb 16, 2009 at 4:21 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

> On Sun, Feb 15, 2009 at 05:23:51PM -0800, Art Clarke wrote:
> > $subject
>
> no, use av_interleaved_write_frame()
>

take 2

-- 
http://www.xuggle.com/
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
video.

Use Xuggle to get the power of FFMPEG in Java.
-------------- next part --------------
Index: output_example.c
===================================================================
--- output_example.c	(revision 17395)
+++ output_example.c	(working copy)
@@ -163,7 +163,7 @@
     pkt.data= audio_outbuf;
 
     /* write the compressed frame in the media file */
-    if (av_write_frame(oc, &pkt) != 0) {
+    if (av_interleaved_write_frame(oc, &pkt) != 0) {
         fprintf(stderr, "Error while writing audio frame\n");
         exit(1);
     }
@@ -372,7 +372,7 @@
         pkt.data= (uint8_t *)picture;
         pkt.size= sizeof(AVPicture);
 
-        ret = av_write_frame(oc, &pkt);
+        ret = av_interleaved_write_frame(oc, &pkt);
     } else {
         /* encode the image */
         out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture);
@@ -390,7 +390,7 @@
             pkt.size= out_size;
 
             /* write the compressed frame in the media file */
-            ret = av_write_frame(oc, &pkt);
+            ret = av_interleaved_write_frame(oc, &pkt);
         } else {
             ret = 0;
         }



More information about the ffmpeg-devel mailing list