Changing ASF / WMV Pixel Aspect Ratio Using WMV Aspect Ratio Changer by DVBPortal

This article helps you understand what SAR, PAR, and DAR are, and how to use the PAR parameter to correct Windows Media Video (WMV) aspect ratio flaws without the need to transcode / re-encode such files in Microsoft’s Advanced Systems Format (ASF).

There are cases where ASF WMV files are encoded in wrong dimensions. This is the reason behind why some videos look squeezed or stretched horizontally when viewed on a normal media player—without DAR correction. In other words, the width/height of the sampled Windows Media Video is not right, or as digital media geeks say, “the storage aspect ratio (SAR) is not right.”

The storage aspect ratio—also called sample aspect ratio—or SAR in short, is simply the ratio of horizontal pixels to vertical pixels, inside the sampled video. For example, the NTSC DVD Video VOB files (720×480) always have a SAR of 1.5 (3:2), regardless of whether they’re encoded for a normal (4:3 / 1.33) or a widescreen (16:9 / 1.78) television.

The pixel aspect ratio (PAR) of a frame is the shape of an individual pixel. For playback purposes it’s important to know the video’s display aspect ratio (DAR), but it’s only if the pixel aspect ratio (PAR) is stored in the video, so it can be used to determine the correct display aspect ratio. Likewise, if no PAR information is stored, it can be calculated from the video’s DAR. For example, the NTSC Video VOB files (720×480) have a PAR of either 1.185 (32:27) or 0.889 (8:9), depending on whether they’re encoded for a normal (4:3 / 1.33) or a widescreen (16:9 / 1.78) television respectively.

The display aspect ratio (DAR)—also called picture aspect ratio—is the actual shape a frame is supposed to be displayed with, rather than simply the resolution. For example, the NTSC and PAL DVD-Video VOB files always have a DAR of either 1.33 or 1.78, depending on whether they’re encoded for a normal (4:3 / 1.33) or a widescreen (16:9 / 1.78) television respectively.

Equations

Storage Aspect Ratio = Horizontally Stored Pixels ÷ Vertically Stored Pixels
or
Storage Aspect Ratio = Width ÷ Height
or simply
SAR = W ÷ H

Display Aspect Ratio = Storage Aspect Ratio × Pixel Aspect Ratio
or simply
DAR = SAR × PAR

To calculate pixel aspect ratio, when we want to force a video with a fixed SAR (this cannot be changed, because it’s actually video’s own width to height ratio) to be displayed with a specific DAR—commonly normal (4:3) or widescreen (16:9):
PAR = DAR ÷ SAR

Change ASF (WMV) Pixel Aspect Ratio Using WMV Aspect Ratio Changer by DVBPortal

The ASF container—like many other containers—has the ability to store a pixel aspect ratio (PAR) data flag, to correct the ratio of the video eventually rendered on the screen. The pixel aspect ratio is set by writing the AspectRatioX and AspectRatioY properties in ASF’s metadata header.

Example

For example, there’s this WMV file, with 720×480 dimensions. From what I’ve described earlier, it has a storage aspect ratio (SAR) of 1.50 (3:2)—right out of the dimensions:

SAR = W ÷ H
SAR = 720 ÷ 480 = 1.50 (3:2)

Trying to watch the video, if I noticed it’s stretched horizontally, I need to correct the display aspect ratio (DAR) to normal 4:3.

DAR: 1.33 (4:3), because video looked horizontally stretched
SAR = W ÷ H
SAR = 720 ÷ 480 = 1.50 (3:2)
PAR = DAR ÷ SAR
PAR = 1.33 ÷ 1.50 = 0.889 (8:9)

So, for this correction, I need a 0.88 (8:9) pixel aspect ratio (PAR).

But if the video looked squeezed horizontally, I’d need to correct the display aspect ratio (DAR) to widescreen 16:9.

DAR: 1.78 (16:9), because video looked horizontally squeezed
SAR = W ÷ H
SAR = 720 ÷ 480 = 1.50 (3:2)
PAR = DAR ÷ SAR
PAR = 1.78 ÷ 1.50 = 1.185 (32:27)

So, for this correction, I’d need a 1.18 (32:27) pixel aspect ratio (PAR).

Now to apply the calculated pixel aspect ratio (PAR) to the ASF/WMV, use WMV Aspect Ratio Changer by Crypto at DVBPortal. Run WMVARChanger.exe and “Load” the .WMV file you want to modify. “Current Aspect Ratio” displays your video’s current aspect ratio, if set. Otherwise, “” is shown. Inside “New Aspect Ratio”, enter “Aspect Ratio X” and “Aspect Ratio Y”, for horizontal and vertical aspect ratios, respectively. (e.g., 32 and 27 for a PAR of 1.185) Now click “Apply” to fix and overwrite the existing file.

Please note you can use the same tool just to remove a WMV’s current aspect ratio, if set. To do so, “Load” the .WMV file, and click “Remove” to patch and overwrite the existing file.

Also please note because WMV Aspect Ratio Changer tends to overwrite its loaded file, I recommend making a clone copy of your WMV/ASF file, and then try to patch the duplicated file using WMVARChanger.exe.

Another Example

There’s an NTSC WMV file, with 704×480 pixels inside (running at 29.97 fps), resulting a storage aspect ratio (SAR) of 1.467:1 (22:15).

Suppose this clip a wide (16:9) motion picture—meaning a picture aspect ratio (DAR) of 1.778:1. Now to make it right, we’d need a pixel aspect ratio (PAR) of 1.212:1 (40:33).

If the same video is a normal (4:3) clip, then we should apply a PAR of 0.909 (10:11).

A PAL Example

There’s this PAL WMV file, encoded containing 704×576 pixels along running at 25 fps. This results a sample aspect ratio (SAR) of 1.222 (11:9).

Now if this is a wide (16:9) HDTV clip, then a pixel aspect ratio (PAR) of 1.455:1 (16:11) is needed to display the movie right. But if the same video is suited to normal (4:3) SDTV screens, then a PAR of 1.091:1 (12:11) would be required.

An NTSC Example

It’s the same as above, only this time, instead of decimals, we’re gonna use fractions and GCD (greatest common divisor) to simplify them. To properly display a 428×240 (30 fps) WMV video on a 4:3 screen, the PAR would have to be set at 80:107.

The GCD (greatest common divisor) for 428 and 240 is 4.
SAR = 428:240 → simplify fraction using gcd(428, 240) = 4 • 428 ÷ 4 = 107 • 240 ÷ 4 = 60 → SAR = 107:60
PAR = DAR ÷ SAR = 4:3 ÷ 107:60 = 80:107

When you have a GCD calculator or better yet a fraction simplifier at hand, leave the fraction simplification for the last.

PAR = DAR ÷ SAR = 4:3 ÷ 428:240 = 960/1284 = 80:107
That last step (960/1284 = 80/107) indeed requires a fraction simplifier calculator or the GCD (greatest common divisor) for 960 and 1284 which is 12, then simplifying fraction using gcd(960, 1284) = 12 • 960 ÷ 12 = 80 • 1284 ÷ 12 = 107 → PAR = 80:107

Now set New Aspect Ratio as Aspect Ratio X: 80 • Aspect Ratio Y: 107 inside WMV Aspect Ratio Changer.

Fix WMV ASF Container Prior to Fixing the Proportions [Updated July 23, 2013]

Sometimes fixing the proportions of an ASF does not affect its playback. I’ve seen cases where Windows Media Player and VLC media player honor the newly set proportions, but Media Player Classic Home Cinema or XBMC doesn’t.

It’s also an effective practice to compare the thumbnails displayed in Windows Explorer (My Computer) for both the original and aspect-modified files to see the difference.

When WMV Aspect Ratio Changer (WMVARChanger.exe) is not able to effectively fix a WMV ASF file’s aspect ratio, it means its ASF container’s structure is corrupt or perhaps substandard at best.

Another case is when a WMV file is not seekable. The aspect ratios of these ASF files also tend to be unfixable by WMV Aspect Ratio Changer. Unbearable as their playback might be, I suggest you to first fix the seek issue prior to fixing the PAR in the ASF container header.

To fix a WMV container structure, the best and most reliable practice is to remux it using FFmpeg. Please note this just recreates the container leaving both audio/video streams unmodified, hence the lossless conversion.

ffmpeg.exe -i "input.wmv" -f asf -vcodec copy -acodec copy -async 1 -y "output.wmv"

One thought on “Changing ASF / WMV Pixel Aspect Ratio Using WMV Aspect Ratio Changer by DVBPortal

Leave a Reply to Stelios Cancel reply

Your email address will not be published. Required fields are marked *

*