[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
Mike Scheutzow
mike.scheutzow
Thu Feb 3 22:42:29 CET 2011
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.
Mike Scheutzow
More information about the ffmpeg-devel
mailing list