[Ffmpeg-devel] DAR and SAR FFmpeg option confusion

Robert Swain robert.swain
Mon Mar 12 16:32:21 CET 2007


Hello,

Benoit Fouet wrote:
> Robert Swain wrote:
>> ffmpeg.c:
>> 3578:    { "aspect", HAS_ARG | OPT_VIDEO,
>> {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or
>> 1.3333, 1.7777)", "aspect" },
>>
>> libavcodec/utils.c:
>> 579:{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio),
>> FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E},
>>
> i'm not sure the one in utils.c should exist (if it is triggered, i'm
> not sure it will lead to a good behavior)...
> to verify this, you can try to use -vaspect option, which should use the
> option in utils.c, and not the one in ffmpeg.c
> there must also be a static in ffmepg.c to handle the aspect ratio,
> which you should not use to set encoder param if you use -vaspect, too...

I'm encoding to x264 and I wrote the code in libavcodec/x264.c to use:

192:    x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num;
193:    x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den;

I haven't done any print debugging but looking at the SAR reported by x264, 
these values are not affected by -vaspect, grepping for vaspect in the code 
returns no results and it isn't documented anywhere yet ffmpeg doesn't report 
any unrecognised option error. :/

>> I tried two command lines with -aspect just after -i and another just
>> before the output file and they exhibited the same behaviour so I
>> assume the position on the command line doesn't affect the meaning. I
>> think -aspect is being used for the frame aspect ratio only.
> it is the case indeed
> 
>> I would make a patch but I don't know how to solve this issue.
> what issue do you think of ?

The issue is that the SAR seemingly cannot be overriden.

>> I would like to be able to set the sample aspect ratio somehow. I'll
>> do the monkey work if someone explains what needs changing. :)

Rob




More information about the ffmpeg-devel mailing list