[FFmpeg-devel] [PATCH] ffmpeg: warns the user when the selected pixel format is ignored

Stefano Sabatini stefano.sabatini-lala at poste.it
Sat Mar 26 15:30:40 CET 2011


On date Saturday 2011-03-26 15:29:16 +0100, Stefano Sabatini encoded:
> ---
>  ffmpeg.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index a8d0dcf..50cda1a 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -593,8 +593,14 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
>              if(*p == st->codec->pix_fmt)
>                  break;
>          }
> -        if(*p == -1)
> +        if (*p == -1) {
> +            av_log(NULL, AV_LOG_WARNING,
> +                   "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
> +                   av_pix_fmt_descriptors[st->codec->pix_fmt].name,
> +                   codec->name,
> +                   av_pix_fmt_descriptors[codec->pix_fmts[0]].name);
>              st->codec->pix_fmt = codec->pix_fmts[0];
> +        }
>      }
>  }

For example:
$ ffmpeg -i slow.flv -pix_fmt gray slow.mp4
[...]
Incompatible pixel format 'gray' for codec 'mpeg4', auto-selecting format 'yuv420p'

It's similiar to a previous patch for choose_sample_fmt().
-- 
FFmpeg = Funny & Freak Mystic Philosophical Enlightened Geisha



More information about the ffmpeg-devel mailing list