[Ffmpeg-devel] DAR and SAR FFmpeg option confusion

Robert Swain robert.swain
Tue Mar 13 03:41:45 CET 2007


Roman Shaposhnik wrote:
> On Tue, 2007-03-13 at 02:27 +0000, Robert Swain wrote:
>> Roman Shaposhnik wrote:
>>> On Tue, 2007-03-13 at 01:01 +0100, Michael Niedermayer wrote:
>>>> -aspect should set DAR, DAR + width and height -> SAR if this doesnt work
>>>> its a bug
>>>   Well, here's the problem DV has (and please let me know if I'm missing
>>> something or if the solution is obvious). Lets take NTSC 4:3 DV as an
>>> example here (just to talk in numbers as opposed to variables):
>>>
>>>    1. FRAME WIDTH == [width in the quote above] == 720
>>>       DISPLAY FRAME HEIGTH == FRAME HEIGHT == 
>>>                      [height in the quote above] == 480 
>>>    
>>>    2. DISPLAY FRAME WIDTH == 704
>>>
>>>    3. DAR == 4:3
>>>
>>>   Now, given your formula, the SAR will be calculated as being 8:9
>>>   where the correct one is 10:11.
>>>
>>> As usual, http://www.mir.com/DMG/aspect.html provides more details.
>> SAR = 10/11
>>
>> DAR = SAR * WIDTH/HEIGHT = (10/11) * (704/480) = 4/3
>>
>> So there's nothing wrong there if it's cropped. If it isn't cropped then:
>>
>> DAR = (10/11) * (720/480) = 15/11
> 
>   Well, that's the point -- if the API Michael mentioned is all we've
> got, how do I specify that I need a SAR of 10:11 ? Currently, I see no
> way of feeding libavcodec with DISPLAY FRAME WIDTH (704) while at the
> same time having an actual ENCODED frame size being bigger (720). Again,
> it could be that I'm missing something so I'd love to be educated 
> (and use the knowledge to fix the DV codec once and for all).

That's the point, the SAR of 10:11 is correct for the 704x480 pixels to be 
displayed with an aspect ratio of 4:3. But you have 720x480 pixels, so you 
assume the SAR of 10:11 (because the sample aspect ratio is constant through any 
cropping/padding process, which is basically what is happening as you're padding 
8 extra pixels to the left and right of the frames) and calculate your DAR from 
that, which is 15:11. Try your NTSC 4:3 DV stream that is 720x280 with -aspect 
15:11.

Rob




More information about the ffmpeg-devel mailing list