[FFmpeg-devel] [PATCH] Make ffmpeg warns the user when the selected sample format is ignored.
Stefano Sabatini
stefano.sabatini-lala
Mon Jan 31 09:48:16 CET 2011
On date Monday 2011-01-31 01:07:11 +0000, M?ns Rullg?rd encoded:
> Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
>
> > ffmpeg.c | 8 +++++++-
> > 1 files changed, 7 insertions(+), 1 deletions(-)
> >
> > diff --git a/ffmpeg.c b/ffmpeg.c
> > index 691b73e..df89018 100644
> > --- a/ffmpeg.c
> > +++ b/ffmpeg.c
> > @@ -600,8 +600,14 @@ static void choose_sample_fmt(AVStream *st, AVCodec *codec)
> > if(*p == st->codec->sample_fmt)
> > break;
> > }
> > - if(*p == -1)
> > + if (*p == -1) {
> > + av_log(NULL, AV_LOG_WARNING,
> > + "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
> > + av_get_sample_fmt_name(st->codec->sample_fmt),
> > + codec->name,
> > + av_get_sample_fmt_name(codec->sample_fmts[0]));
> > st->codec->sample_fmt = codec->sample_fmts[0];
> > + }
> > }
> > }
> >
> > --
> > 1.7.2.3
>
> This looks good. Do you have a sample command line I can test it with?
$ ffmpeg -i INPUT -sample_fmt u8 -y out.wav
...
Incompatible sample format 'u8' for codec 'pcm_s16le', auto-selecting format 's16'
--
FFmpeg = Fundamental Fundamental Mournful Pitiful Encoding/decoding Glue
More information about the ffmpeg-devel
mailing list