1. Zakhar Zibarov
  2. FFVideo
  3. Issues
Issue #11 new

Add DAR and SAR attributes to VideoStream

Anonymous created an issue

Many of my video files have DAR (display aspect ratio) values that don't match the frame size. The same can also be true for the SAR (source aspect ratio). These values describe video streams with non-square pixels. Consequently, frame images once extracted can appear stretched because they assume a square pixel. I have no way of knowing how much to re-scale the image without shelling out to another utility.

Please add DAR and SAR attributes to VideoStream objects, so that the end-user will know when to re-scale the frame images and by how much. I recommend returning a tuple of (int, int) instead of a computed float value.

Optionally, you might also add a PAR attribute (pixel aspect ratio), which is computed by multiplying the DAR and SAR. Or it might be simpler to just let the end-user can do the math.

You can see the DAR and SAR in the output of "ffmpeg -i" immediately after the frame dimensions. In this example, the frame is 640 by 480 pixels with a DAR of 15:8 (or 1.875) and a SAR of 45:32 (or just slightly non-square pixels in the 640x480 source):

Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 640x480 [SAR 45:32 DAR 15:8], 700 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc

Comments (0)

  1. Log in to comment