[FFmpeg-user] Question about handling / unwanted changes of SAR in ffmpeg

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Dec 27 21:32:45 EET 2018


2018-12-27 10:50 GMT+01:00, Uwe Freese <uwe.freese at gmx.de>:
> Am 26.12.18 um 15:08 schrieb Reino Wijnsma:
>>>      Stream #0:0: Video: h264 (High), yuv420p(progressive), 688x560 [SAR
>>> 64:45 DAR 2752:1575], SAR 172:121 DAR 7396:4235, 50 fps, 50 tbr, 1k tbn,
>>> 100 tbc (default)
>>>
>>> What does SAR (and DAR) mean in the brackets compared to the second SAR
>>> 172:121, which is slightly different?
>> As far as I know:
>>
>> 688    x 64/45     = 978,49w
>> 978,49 x 1575/2752 = 560h     --> 978x560 @ bitstream level
>> 688    x 172/121 =   977,98w
>> 977,98 x 4235/7396 = 560h     --> 977x560 @ container level
>
> So when I understand correctly, it could be that somewhere in ffmpeg,
> the 64/45 is rounded to 978, given to another function / class
> calculating the SAR for the container level, and this calculates to
> 172/121, which is best matching for 978?

> Instead, the better solution would then be to give the SAR to whatever
> calculates the SAR to store at container level not as a double or int,
> but as a "AVRational", which contains the "num" and "den" values (in
> this case 64 and 45)?

This is exactly what FFmpeg does (since forever).

Carl Eugen


More information about the ffmpeg-user mailing list