]> granicus.if.org Git - handbrake/commitdiff
encavcodec: fix 2 pass vp8 and vp9 encoding
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 27 Dec 2016 16:57:06 +0000 (08:57 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 27 Dec 2016 17:00:02 +0000 (09:00 -0800)
libvpx only supplies the stats upon the final flush of the encoder.  So
we must also write stats after final flush.

(cherry picked from commit d64dba737d0136b58545be33c50db093df1880c1)

libhb/encavcodec.c

index 0543fe47c50d9f6e1f86da1f7b7f001d0ceea82f..591aa4f08949f4e908fda34a78c681eb44b1b1e2 100644 (file)
@@ -610,6 +610,15 @@ static void Flush( hb_work_object_t * w, hb_buffer_list_t * list )
     hb_work_private_t * pv = w->private_data;
 
     avcodec_send_frame(pv->context, NULL);
+
+    // Write stats
+    // vpx only writes stats at final flush
+    if (pv->job->pass_id == HB_PASS_ENCODE_1ST &&
+        pv->context->stats_out != NULL)
+    {
+        fprintf( pv->file, "%s", pv->context->stats_out );
+    }
+
     get_packets(w, list);
 }