From 68799d8e3d4858f3cfe8a3c4227a7823dbafa39c Mon Sep 17 00:00:00 2001 From: jbrjake Date: Thu, 29 May 2008 15:54:08 +0000 Subject: [PATCH] When encoding anamorphic with lavc, ensure PAR values are 8-bit. Thanks, j45! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1470 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/work.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libhb/work.c b/libhb/work.c index 503403edd..9c2ecbf9a 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -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 -- 2.49.0