[FFmpeg-devel] [PATCH] Print pixel and screen aspect ratios
Robert Swain
robert.swain
Thu Oct 18 14:37:44 CEST 2007
Hello,
On 18 Oct 2007, at 12:49, Michel Bardiaux wrote:
> Index: libavcodec/utils.c
> ===================================================================
> --- libavcodec/utils.c (revision 10716)
> +++ libavcodec/utils.c (working copy)
> @@ -1075,6 +1075,7 @@
> char buf1[32];
> char channels_str[100];
> int bitrate;
> + AVRational screen_aspect_ratio;
>
> if (encode)
> p = avcodec_find_encoder(enc->codec_id);
> @@ -1125,6 +1126,14 @@
> snprintf(buf + strlen(buf), buf_size - strlen(buf),
> ", %dx%d",
> enc->width, enc->height);
> + av_reduce(&screen_aspect_ratio.num,
> &screen_aspect_ratio.den,
> + enc->width*enc->sample_aspect_ratio.num,
> + enc->height*enc->sample_aspect_ratio.den,
> + 1024*1024);
> + snprintf(buf + strlen(buf), buf_size - strlen(buf),
> + " [PAR %d:%d SAR %d:%d]",
SAR is a bad choice of nomenclature, one because everyone else calls
this the display aspect ratio, as far as I am aware, and two because
SAR is an abbreviation for an alternative to PAR (pixel vs sample,
same meaning).
> + enc->sample_aspect_ratio.num, enc-
> >sample_aspect_ratio.den,
> + screen_aspect_ratio.num,
> screen_aspect_ratio.den);
> if(av_log_level >= AV_LOG_DEBUG){
> int g= ff_gcd(enc->time_base.num, enc-
> >time_base.den);
> snprintf(buf + strlen(buf), buf_size - strlen(buf),
Regards,
Rob
More information about the ffmpeg-devel
mailing list