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

MXF: fix incorrect pixel aspect ratio #1883

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Source/MediaInfo/File__Analyze_Streams_Finish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,25 @@ void File__Analyze::Streams_Finish_StreamOnly_Video(size_t Pos)
Fill(Stream_Video, Pos, Video_FrameRate, FrameCount/Duration, 3);
}

//Pixel Aspect Ratio forced to 1.000 if none
//Pixel Aspect Ratio forced from picture pixel size and Display Aspect Ratio
if (Retrieve(Stream_Video, Pos, Video_PixelAspectRatio).empty())
{
const Ztring& DAR_S=Retrieve_Const(Stream_Video, Pos, Video_DisplayAspectRatio);
float DAR=DAR_S.To_float32();
float Width=Retrieve(Stream_Video, Pos, Video_Width).To_float32();
float Height=Retrieve(Stream_Video, Pos, Video_Height).To_float32();
if (DAR && Height && Width)
{
if (DAR_S==__T("1.778"))
DAR=((float)16)/9; //More exact value
if (DAR_S==__T("1.333"))
DAR=((float)4)/3; //More exact value
Fill(Stream_Video, Pos, Video_PixelAspectRatio, DAR/(((float32)Width)/Height));
}
}

//Pixel Aspect Ratio forced to 1.000 if none
if (Retrieve(Stream_Video, Pos, Video_PixelAspectRatio).empty() && Retrieve(Stream_Video, Pos, Video_DisplayAspectRatio).empty())
Fill(Stream_Video, Pos, Video_PixelAspectRatio, 1.000);

//Standard
Expand Down