]> granicus.if.org Git - handbrake/commitdiff
scan: enable HBTF_NO_IDR when not enough previews found
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 11 Apr 2017 18:23:56 +0000 (12:23 -0600)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 11 Apr 2017 18:27:22 +0000 (12:27 -0600)
Setting this flag signals to libav to not wait for IDR or recovery
points before returning frames to us.  Some videos have neither IDRs or
recovery points, so this fixes transcoding such video.

Fixes https://github.com/HandBrake/HandBrake/issues/456

libhb/scan.c

index 663ddc6f1538399cd2b340f95c1e26583568b542..8b5c5d47a5e5d97b9d722351f9994b7f90ee37cd 100644 (file)
@@ -223,6 +223,10 @@ static void ScanFunc( void * _data )
         npreviews = DecodePreviews( data, title, 1 );
         if (npreviews < 2)
         {
+            // Try harder to get some valid frames
+            // Allow libav to return "corrupt" frames
+            hb_log("scan: Too few previews (%d), trying harder", npreviews);
+            title->flags |= HBTF_NO_IDR;
             npreviews = DecodePreviews( data, title, 0 );
         }
         if (npreviews == 0)