[FFmpeg-user] Two SAR/DAR pairs (codec and stream SAR/DAR)

Tobias Rapp t.rapp at noa-archive.com
Tue Dec 1 09:32:14 CET 2015

On 30.11.2015 15:27, Nikita Skalkin wrote:
> Hello everyone! In our company, we use ffmpeg to parse video info and
> convert it, according parsed info. Recently we found a bug in our system.
> When calling ffprobe for video, we got 2 SAR/DAR pairs.
> Example:
> Stream #0:0(eng): Video: mpeg2video (4:2:2) (mx3p / 0x7033786D),
> yuv422p(tv, bt470bg/smpte170m/bt709), 720x608 [SAR 152:135 DAR 4:3], 30105
> kb/s, SAR 35:24 DAR 525:304, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
> In our system we use first pair for detecting video aspect. But in test
> video it gives us not correct aspect (for our algorithms), whilst second
> pair is right.
> I found commit (082491c), that explains second pair. Commits comment says
> that ffmpeg prints second pair if stream SAR differs from codec SAR. But I
> coundn’t find what is codec SAR, and why it differs from streams SAR. Could
> you explain it for me?

Some video codecs allow to store the aspect ratio within the binary data 
chunk of each encoded frame. Also some container formats allow to store 
the aspect ratio globally for the whole stream (file). Now when both 
values exist they possibly contain mismatching information. Which value 
is the correct one is not obvious, I guess media players have some own 
guessing algorithm to decide which one to use.


More information about the ffmpeg-user mailing list