]> git.sesse.net Git - mlt/commitdiff
Fix compressed video output in avformat.
authorDan Dennedy <dan@dennedy.org>
Thu, 20 Jun 2013 03:23:29 +0000 (20:23 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 20 Jun 2013 03:25:34 +0000 (20:25 -0700)
src/modules/avformat/consumer_avformat.c

index e8ea75f11df09053b129ddfef82d6fd9d5ddf5c7..bdfd556dc744aa3fa66c93150c076826ab7464a9 100644 (file)
@@ -1874,16 +1874,29 @@ static void *consumer_thread( void *arg )
                                        {
                                                AVPacket pkt;
                                                av_init_packet( &pkt );
-                                               pkt.data = video_outbuf;
-                                               pkt.size = video_outbuf_size;
+                                               if ( c->codec->id == AV_CODEC_ID_RAWVIDEO ) {
+                                                       pkt.data = NULL;
+                                                       pkt.size = 0;
+                                               } else {
+                                                       pkt.data = video_outbuf;
+                                                       pkt.size = video_outbuf_size;
+                                               }
 
                                                // Set the quality
                                                converted_avframe->quality = c->global_quality;
+                                               converted_avframe->pts = frame_count;
 
                                                // Set frame interlace hints
                                                converted_avframe->interlaced_frame = !mlt_properties_get_int( frame_properties, "progressive" );
                                                converted_avframe->top_field_first = mlt_properties_get_int( frame_properties, "top_field_first" );
-                                               converted_avframe->pts = frame_count;
+#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(61<<8)+100)
+                                               if ( mlt_properties_get_int( frame_properties, "progressive" ) )
+                                                       c->field_order = AV_FIELD_PROGRESSIVE;
+                                               else if ( c->codec_id == AV_CODEC_ID_MJPEG )
+                                                       c->field_order = (mlt_properties_get_int( frame_properties, "top_field_first" )) ? AV_FIELD_TT : AV_FIELD_BB;
+                                               else
+                                                       c->field_order = (mlt_properties_get_int( frame_properties, "top_field_first" )) ? AV_FIELD_TB : AV_FIELD_BT;
+#endif
 
                                                // Encode the image
 #if LIBAVCODEC_VERSION_MAJOR >= 55
@@ -2068,8 +2081,13 @@ static void *consumer_thread( void *arg )
                        AVCodecContext *c = video_st->codec;
                        AVPacket pkt;
                        av_init_packet( &pkt );
-                       pkt.data = video_outbuf;
-                       pkt.size = video_outbuf_size;
+                       if ( c->codec->id == AV_CODEC_ID_RAWVIDEO ) {
+                               pkt.data = NULL;
+                               pkt.size = 0;
+                       } else {
+                               pkt.data = video_outbuf;
+                               pkt.size = video_outbuf_size;
+                       }
 
                        // Encode the image
 #if LIBAVCODEC_VERSION_MAJOR >= 55