If i package a 480p video (480x854), (or any video which has different PAR than its width/height)
GPAC produces the wrong PAR and SAR values in the adaption set.
I use the following command:

```bash
gpac 
-i video.mp4:gpac:#PAR=16/9
-o dash.mpd:profile=dashavc264.onDemand:dual:cmaf=cmf2:styp:sfile:bs_switch=both:segdur=15:sbound=closest
```
It produces incorrect output:
```xml
<AdaptationSet segmentAlignment="true" maxWidth="854" maxHeight="480" maxFrameRate="60" par="427:240" lang="eng" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
  <Representation id="0" mimeType="video/mp4" codecs="avc1.64001F" width="854" height="480" frameRate="60" sar="1:1" bandwidth="1035863">
    <BaseURL>video_track1_init.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="970-1013">
      <Initialization range="0-941"/>
    </SegmentBase>
  </Representation>
</AdaptationSet>
```

As you can see, GPAC has set the following PAR and SAR values:
```ini
AdaptationSet@par = 427:240
Representation@sar = 1:1
```
These values are wrong, because i specified a PAR of 16:9 at the command line, and the SAR should be calculated from that. Allthough these values will technically work, they will causes conflicts if multiple representations are used.

Lets take a look at what the DASH-IF guidelines [[source]](https://dashif-documents.azurewebsites.net/DASH-IF-IOP/master/DASH-IF-IOP.html#video-constraints) say about that:

> Note: `@width` and `@height` indicate the number of encoded pixels. `@par` indicates the final intended display aspect ratio and `@sar` is effectively the ratio of aspect ratios (ratio of `@width` x `@height` to `@par`).
>
> Given a coded picture of 720x576 pixels with an intended display aspect ratio of 16:9, we would have the following values:
> `@width`=720
> `@height`=576
> `@par`=16:9
> `@sar`=45:64 (720x576 is 5:4, which gives `@sar`=5:4/16:9=45:64)

 So, applying this to our example, the correct values (according to DASH-IF) should be:
```ini
AdaptationSet@par = 16:9
Representation@sar = 1281:1280 # is calculated using (width/height)/par , in this case: (854/480)/(16/9)
```

I hope i explained the issue detailed enough :)
[BUG] Aspect ratios are handled incorrectly by GPAC when PAR is different than width/height
This is a GitHub Issue
repo:gpac
owner:gpac
Title : [BUG] Aspect ratios are handled incorrectly by GPAC when PAR is different than width/height
Issue date:

--- start body ---
If i package a 480p video (480x854), (or any video which has different PAR than its width/height)
GPAC produces the wrong PAR and SAR values in the adaption set.
I use the following command:

```bash
gpac 
-i video.mp4:gpac:#PAR=16/9
-o dash.mpd:profile=dashavc264.onDemand:dual:cmaf=cmf2:styp:sfile:bs_switch=both:segdur=15:sbound=closest
```
It produces incorrect output:
```xml
<AdaptationSet segmentAlignment="true" maxWidth="854" maxHeight="480" maxFrameRate="60" par="427:240" lang="eng" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
  <Representation id="0" mimeType="video/mp4" codecs="avc1.64001F" width="854" height="480" frameRate="60" sar="1:1" bandwidth="1035863">
    <BaseURL>video_track1_init.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="970-1013">
      <Initialization range="0-941"/>
    </SegmentBase>
  </Representation>
</AdaptationSet>
```

As you can see, GPAC has set the following PAR and SAR values:
```ini
AdaptationSet@par = 427:240
Representation@sar = 1:1
```
These values are wrong, because i specified a PAR of 16:9 at the command line, and the SAR should be calculated from that. Allthough these values will technically work, they will causes conflicts if multiple representations are used.

Lets take a look at what the DASH-IF guidelines [[source]](https://dashif-documents.azurewebsites.net/DASH-IF-IOP/master/DASH-IF-IOP.html#video-constraints) say about that:

> Note: `@width` and `@height` indicate the number of encoded pixels. `@par` indicates the final intended display aspect ratio and `@sar` is effectively the ratio of aspect ratios (ratio of `@width` x `@height` to `@par`).
>
> Given a coded picture of 720x576 pixels with an intended display aspect ratio of 16:9, we would have the following values:
> `@width`=720
> `@height`=576
> `@par`=16:9
> `@sar`=45:64 (720x576 is 5:4, which gives `@sar`=5:4/16:9=45:64)

 So, applying this to our example, the correct values (according to DASH-IF) should be:
```ini
AdaptationSet@par = 16:9
Representation@sar = 1281:1280 # is calculated using (width/height)/par , in this case: (854/480)/(16/9)
```

I hope i explained the issue detailed enough :)
--- end body ---
