]> granicus.if.org Git - handbrake/commitdiff
When encoding anamorphic with lavc, ensure PAR values are 8-bit. Thanks, j45!
authorjbrjake <jb.rubin@gmail.com>
Thu, 29 May 2008 15:54:08 +0000 (15:54 +0000)
committerjbrjake <jb.rubin@gmail.com>
Thu, 29 May 2008 15:54:08 +0000 (15:54 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1470 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/work.c

index 503403edde1c4b49f754d0803f1b67bec8e2d0ee..9c2ecbf9ae9988e1a1eedefdb506794eae9932bb 100644 (file)
@@ -136,7 +136,21 @@ static void do_job( hb_job_t * job, int cpu_count )
            so they fit into the user's specified dimensions. */
         hb_set_anamorphic_size(job, &job->width, &job->height, &job->pixel_aspect_width, &job->pixel_aspect_height);
     }
-
+    
+    if( job->pixel_ratio && job->vcodec == HB_VCODEC_FFMPEG)
+    {
+        /* Just to make working with ffmpeg even more fun,
+           lavc's MPEG-4 encoder can't handle PAR values >= 255,
+           even though AVRational does. Adjusting downwards
+           distorts the display aspect slightly, but such is life. */
+        while ((job->pixel_aspect_width & ~0xFF) ||
+               (job->pixel_aspect_height & ~0xFF))
+        {
+            job->pixel_aspect_width >>= 1;
+            job->pixel_aspect_height >>= 1;
+        }
+    }
+    
        /* Keep width and height within these boundaries,
           but ignore for "loose" anamorphic encodes, for
           which this stuff is covered in the pixel_ratio