diff options
-rw-r--r-- | libhb/common.c | 2 | ||||
-rw-r--r-- | libhb/scan.c | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/libhb/common.c b/libhb/common.c index fde9c9a55..ef067f545 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -3690,7 +3690,7 @@ hb_title_t * hb_title_init( char * path, int index ) t->video_timebase.num = 1; t->video_timebase.den = 90000; t->angle_count = 1; - t->geometry.par.num = 1; + t->geometry.par.num = 0; t->geometry.par.den = 1; return t; diff --git a/libhb/scan.c b/libhb/scan.c index 7d30b6487..d72a98921 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -1002,8 +1002,21 @@ skip_preview: } title->video_bitrate = vid_info.bitrate; - if( vid_info.geometry.par.num && vid_info.geometry.par.den ) + if (data->dvd || data->bd) { + // DVD/BD doesn't have a container PAR, but it has container DAR + // which can be used to compute container PAR + hb_reduce(&title->geometry.par.num, &title->geometry.par.den, + title->geometry.height * title->container_dar.num, + title->geometry.width * title->container_dar.den); + } + if (vid_info.geometry.par.num && vid_info.geometry.par.den) + { + // title->geometry.par is initially container PAR, but + // the video stream almost always also supplies PAR and + // is generally more reliable, so use it. + // + // Check if container PAR and video stream PAR are in agreement if (title->geometry.par.num && title->geometry.par.den && title->geometry.par.num != vid_info.geometry.par.num && title->geometry.par.den != vid_info.geometry.par.den) @@ -1014,6 +1027,11 @@ skip_preview: } title->geometry.par = vid_info.geometry.par; } + else if (!title->geometry.par.num || !title->geometry.par.den) + { + // No video PAR found, assume 1:1 + title->geometry.par.num = title->geometry.par.den = 1; + } title->pix_fmt = vid_info.pix_fmt; title->color_prim = vid_info.color_prim; title->color_transfer = vid_info.color_transfer; |