There are 2 different things:
- The real width and height of frames (in pixels) - see the green part of the folowing picture.
- The displayed width and height (during the playback) - see the blue part of the same picture.
The problem arose in old bad days, when the resolution of devices (number of pixels in the image) was very low, but the required ratio of width to hight for the playback was 4:3.
The solution (in those days) was the invention of non-square pixels.
For the sake of simplicity let's suppose (theoretically) very low dimensions:
- required: 4×3 pixels (i. e. 12 pixels) per frame.
- real possible (for the acceptable price): 3×3 (i. e. 9 pixels).
The solution was non-square pixels with the pixel aspect ratio (PAR) 4:3, as here:
So the pixel aspect ratio (PAR) is the ratio of sizes of every one individual pixel:
Every blue pixels in our image has PAR 4:3, and every orange and every green one has PAR 1:1.
Now our whole (blue) image is displayed correctly, as we wanted - e. g. as 12 cm x 9 cm - so its Display Aspect Ratio (DAR) is 12:9, or 4:3.
In spite of it, it's saved as 3 x 3 pixels - so the Storage Aspect Ratio (SAR) is 3 pixels : 3 pixels, or 1:1.
- pixel aspect ratio (PAR) is micrometers : micrometers
- display aspect ratio (DAR) is centimeters : centimeters
- storage aspect ratio (SAR) is pixels : pixels
Consequently, the relation between these 3 values is
DAR = SAR × PAR
The important note:
Sometimes is PAR (Pixel Aspect Ratio) called Sample Aspect Ratio - as in FFmpeg. Unfornately, the abbreviation for it is then SAR, which is very confusing, because - as we saw - it's also the abbreviation for Storage Aspect ratio.
The main problem:
Nowadays all devices have pixel aspect ratio 1:1 (square pixels), and many media players, mainly for small devices (cell phones, tablets), rely on it, fully ignoring the DAR value stored in video streams.
So you may encounter the situation when the same video (made from all sources) is played back correctly in your desktop or laptop computer, but incorrectly (narrowed) in your smartphone. Or even on the other media player on the same computer or device.
In our example, the frames may be wrongly displayed as a square (see the green part of the image above).
The solution of this problem in FFmpeg:
- resize the problematic video, then
- set the SAR of it to 1, and
- the DAR has very likely the correct value, but you may set it to be sure.
In our (unreal) example you may use the filtergraph
w is the with of (just scaled) frames in pixels,
h is their height. FFmpeg substitute the appropriate values automatically.
The result will be the orange part of the above image.
In your case, your video has (from your info)
- DAR 4:3 (640:480),
- SAR (Storage Aspect Ratio) 720:480 = 3:2, and - consequently -
- PAR = DAR / SAR = 8:9. (In the FFmpeg terminology it is SAR - Sample Aspect Ratio).
So to avoid problems with media players ignoring the DAR value (and play back it in the proportion 720:480, you may consider to convert it with the command
ffmpeg -i your_input_file -vf -scale=640:480,setsar=1 -c:a copy your_output_file
Problems with pictures with non-square pixels:
With pictures the situation is even much worse:
Almost all Picture Viewers/Editors and Internet Browsers simply ignore images SAR and DAR, supposing that all pictures over the world have SAR 1:1.
The honorable exception is (interestingly and surprisingly enough) Microsoft Windows Photo Viewer, which displays all pictures correctly.
You may become convinced of it e. g. by the The Pixel Aspect Ratio Acid Test - all 9 pictures there should be displayed correctly in your browser, but - highly likely - they aren't.