Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPEG-1 pixel aspect ratio is reciprocal of actual value #410

Closed
bvibber opened this issue Feb 15, 2023 · 1 comment · Fixed by #411
Closed

MPEG-1 pixel aspect ratio is reciprocal of actual value #410

bvibber opened this issue Feb 15, 2023 · 1 comment · Fixed by #411

Comments

@bvibber
Copy link
Contributor

bvibber commented Feb 15, 2023

Just noticed that for MPEG-1 video, the pixel aspect ratio was coming out as the reciprocal of the desired value. The values in the array in videoAspectRatioLookup are correct to spec but they are reciprocals of the final values, as confirmed by an old note on http://forum.doom9.org/archive/index.php/t-84400.html :

====================================================================================
MPEG-1

Based on "pel_aspect_ratio" located in the Sequence Header

DAR = PAR x SAR

where PAR = the reciprocal of 1.0000, 0.6735, 0.7031, 0.7615, 0.8055,
0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575 or
1.2015 for pel_aspect_ratio values of "1" thru "14" respectively.

However:

0.9157 is commonly accepted to mean 11/12 or .9166, the reciprocal of 12/11 (1.091) and,
1.0950 is commonly accepted to mean 11/10 or 1.1, the reciprocal of 10/11 (0.909)

====================================================================================

Many MPEG-1 files have square pixels and wouldn't be affected, but those that are encoded for 352x240 or 352x288 from NTSC or PAL television captures will report the wrong aspect ratio. MPEG-2 files listing display aspect ratio are not affected.

This is easily resolved with a one-liner, patch will be attached shortly.

bvibber added a commit to bvibber/getID3 that referenced this issue Feb 15, 2023
The reciprocal of the actual value was being returned for MPEG-1
video. Files with square pixels were not affected, nor were MPEG-2
files listing a display aspect ratio.

Fixes JamesHeinrich#410
@bvibber
Copy link
Contributor Author

bvibber commented Feb 15, 2023

Here's an example file that's affected. 352x240 4:3 NTSC capture, so pixel aspect ratio should report as <1 (tall) not >1 (wide)

https://brionv.com/media/caesar2k-trailer.mpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant