Fix video aspect ratio calculation

This commit is contained in:
Nicolas Le Goff 2014-06-10 12:27:04 +02:00
commit c51ccf4f2c
2 changed files with 44 additions and 10 deletions

View file

@ -72,7 +72,12 @@ class Stream extends AbstractData
if (null !== $displayRatio && null !== $sampleRatio) {
if ($sampleRatio[0] !== 1 && $sampleRatio[1] !== 1) {
$width = round($width / $sampleRatio[0] * $sampleRatio[1] * $displayRatio[0] / $displayRatio[1]);
if (null !== $width && null !== $height) {
// stretch video according to pixel sample aspect ratio
$width = round($width * ($sampleRatio[0] / $sampleRatio[1]));
// set height according to display aspect ratio
$height = round($width * ($displayRatio[1] / $displayRatio[0]));
}
}
}