-
Notifications
You must be signed in to change notification settings - Fork 244
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-2 videos return wrong aspect ratio #148
Comments
Since you're familiar with the issue, are you able to submit a patch to correct the issue? |
Yes, can do. :) |
Actually don't worry about it, the problem was simpler than I thought, so I've fixed it in 97dd360 |
One more tweak -- the MPEG-2 aspect ratios are display aspect ratios, not pixel aspect ratios, so the value from the lookup table needs to be multiplied by I believe |
Specifically, the value for square pixels should return a pixel aspect ratio of 1, while the other values need to be scaled from display aspect to pixel aspect. |
(corrected after double-checking spec) JamesHeinrich#148
* fix array lookup * calculate pixel aspect ratio from display aspect ratios * delay calc of aspect ratio until after extended size is known * mirror the updated pixel aspect ratio up to the 'video' section Fixes remaining issues with JamesHeinrich#148
* fix array lookup * calculate pixel aspect ratio from display aspect ratios * delay calc of aspect ratio until after extended size is known * mirror the updated pixel aspect ratio up to the 'video' section Fixes remaining issues with JamesHeinrich#148
Working on adding MPEG-2 video upload to MediaWiki I noticed that getid3 on this MPEG-2 file https://archive.org/download/FolgersCoffe/FolgersCoffe.mpeg returns an incorrect
['video']['pixel_aspect_ratio']
of 0.6735, which is the MPEG-1 interpretation of the value 2 for the aspect ratio field.In MPEG-2, the field should be interpreted differently, as a key to a list of display aspect ratios, in this case 2 mapping to 4:3 (see eg https://web.archive.org/web/20170910202756/http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html )
Workaround: pull the raw field value out from
['mpeg']['video']['raw']['aspect_ratio_information']
and interpret it directly.Recommended fix: if the file is found to be MPEG-2, calculate the correct pixel aspect ratio from the given size and the display aspect ratio key and override the MPEG-1 mapping.
The text was updated successfully, but these errors were encountered: