How to fix pixel aspect ratio?

Started by hanna_heger, July 27, 2024, 04:23:49 AM

Previous topic - Next topic

hanna_heger

Hello, I am currently trying to convert an MPG file into MKV. But the original pixel ratio is D1/DV PAL (1.0940). So when converted to a square pixel (1.0) ratio, the final video ends up looking horizontally deformed, "crushed".

Is there a way to fix this in Avidemux? Thank you!

Windows 10/Avidemux 2.8.1 Release

Geo_log

Quote from: hanna_heger on July 27, 2024, 04:23:49 AMIs there a way to fix this in Avidemux?
Open "Filters" - "Transform" - "swsResize" - uncheck "Lock Aspect Ratio" - enter proper "Width" and "Height".

In Avidemux the PAR (Pixel Aspect Ratio) is always 1:1.

hanna_heger

How can I discover what would be the correct width and height?

eumagga0x2a

First of all, 2.8.1 is terribly outdated, I'd recommend using a recent 2.8.2 nightly build or (better) building from source as the last official build is also quite old.

Are you re-encoding or just storing a MPEG (MPEG-2?) video stream in a Matroska container? If latter, you could just force display aspect ratio in MKV muxer configuration dialog.

For a 704x576 source, the display width in square pixels would be 768. This matches (4/3)*(576/704) = 1.090909... pixel aspect ratio perfectly. The situation with 720x576 sources is somewhat complicated: the output should be 768 px wide as well, because the decoded source is meant to be cropped by 8 pixels left and right before the resulting 704x576 picture is transformed according to pixel aspect ratio. The MKV muxer in Avidemux doesn't support specifying crop values, so the result will be imperfect.

If you re-encode, you have a choice either to rescale the picture to square pixels or to specify anamorphic display in SAR (sample aspect ratio) settings of the respective video encoder (not all allow that). You probably should force display aspect ratio in the muxer nevertheless as most video players prioritize the pixel aspect ratio stored in the container over that provided by the codec.

Please make sure that if you re-encode and the source is interlaced, you either tell the encoder that the input is interlaced and which field comes first (not all encoders support this!) or, better, insert a deinterlacing filter at the first place in the filter chain prior to any other transformations.

eumagga0x2a

Quote from: eumagga0x2a on July 27, 2024, 05:27:51 PMYou probably should force display aspect ratio in the muxer nevertheless as most video players prioritize the pixel aspect ratio stored in the container over that provided by the codec.

My wording may be confusing. The above is valid only for the case when you choose NOT to rescale video to square pixels.