[FFmpeg-devel] [PATCH 2/2] Add sample_aspect_ratio fields to vsrc_buffer arguments. This fixes aspect handling in ffmpeg This is based on a patch by baptiste

Stefano Sabatini stefano.sabatini-lala
Fri Feb 4 01:16:11 CET 2011


On date Thursday 2011-02-03 16:42:29 -0500, Mike Scheutzow encoded:
> Mans Rullgard wrote:
> >From: Michael Niedermayer <michaelni at gmx.at>
> >--- a/ffmpeg.c
> >+++ b/ffmpeg.c
> >@@ -2845,6 +2855,10 @@ static void opt_frame_aspect_ratio(const char *arg)
> >         ffmpeg_exit(1);
> >     }
> >     frame_aspect_ratio = ar;
> >+
> >+    x = vfilters ? strlen(vfilters) : 0;
> >+    vfilters = av_realloc(vfilters, x+100);
> >+    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);
> > }
> > static int opt_metadata(const char *opt, const char *arg)
> 
> 1. This will fail to compile if CONFIG_AVFILTER == 0
> 
> 2. The user's attempt to set DAR may be silently ignored.
> 
> This patch effectively rewrites "-aspect <float>" as "-vf
> setdar=<float>". So the user's attempt to set DAR will be ignored
> for a command line like this:
> 
> ffmpeg -i infile -aspect 1.7778 -vf "scale=360:240" outfile
> 
> This is because the current ffmpeg behavior is to keep only the
> final -vf argument on the command line.
> 
> Command line argument ordering is already very complicated in
> ffmpeg. We shouldn't make it even more difficult to get the desired
> output file.
> 
> One solution is to have -vf abort (with a good error message) if
> 'vfilters' is already non-null.

Simpler variant of this, forces the user to use setdar if libavfilter
is enabled.
-- 
FFmpeg = Fascinating and Frightening MultiPurpose Ecstatic God



More information about the ffmpeg-devel mailing list