Menu

#958 MP4 muxing incorrect aspect ratio

General
pending
nobody
None
5
2023-04-07
2020-10-11
hello_hello
No

MeGUI doesn't always use the correct aspect ratio when muxing AVC video as MP4. MKV muxing is fine, as MeGUI doesn't specify a SAR for muxing as it does for MP4.

I suspect the problem is due to MeGUI relying on MediaInfo to provide the aspect ratio of the raw AVC (rather than use the same SAR it did for encoding), and MediaInfo appears to report two display aspect ratios for resolutions of 720x576/480 if the aspect ratio is close to 16:9 or 4:3. Here's some log file highlights.

The command line for encoding:
"C:\Program Files\MeGUI\tools\x264\x264.exe" --level 4.1 --preset slow --tune film --crf 18.0 --min-keyint 25 --b-adapt 2 --me umh --stitchable --colormatrix smpte170m --sar 181:125 --frames 100 --output "D:\test.avs"

From the x264 standard error stream:
x264 [info]: using SAR=181/125

For the muxing part of the job, the log file shows the following in the MediaInfo section:
-[Information] AspectRatio: 1.810
-[Information] AspectRatioString: 16:9
-[Information] PixelAspectRatio: 1.448

And I assume MeGUI is then using AspectRatioString string to recalulate the SAR/PAR, resulting in the following command line for muxing:
"C:\Program Files\MeGUI\tools\mp4box\mp4box.exe" -add "D:\test.264#trackID=1:fps=23.976:par=64:45:name=" -tmp "D:\" -new "D:\test.mp4"

MediaInfo's take on the muxed MP4:
-[Information] AspectRatio: 1.778
-[Information] AspectRatioString: 16:9
-[Information] PixelAspectRatio: 1.422

A quick test seems to indicate the above problem only occurs when MeGUI is obtaining the DAR from the global variables in a script. If a SAR is specified in the encoder configuration it's also used for muxing.

I suspect MeGUI is also relying on the wrong information from MediaInfo for source files with a resolution of 720x576/480, as when opening an MKV with an aspect ratio that's close to 16:9, it defaults to a generic or ITU Input DAR even though the correct aspect ratio might ne slightly different and written to the source file.

Thanks.

Discussion

  • hello_hello

    hello_hello - 2020-10-11

    Update: It looks like I was wrong when I said the problem doesn't occur if a SAR is specified in the encoder configuration. I mist have been looking at the wrong encode in the log file and confused myself.

     
  • Zathor

    Zathor - 2023-04-07

    Thank you very much for the report. Does that still happen nowadays?

     
  • Zathor

    Zathor - 2023-04-07
    • status: open --> pending
     

Log in to post a comment.

Auth0 Logo