[FFmpeg-devel] CrystalHD and ffmpeg probe behaviour

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Jan 15 23:09:40 CET 2012


On Sun, Jan 15, 2012 at 02:40:34PM -0700, Philip Langdale wrote:
> On 14.01.2012 16:23, Reimar Döffinger wrote:
> >On Sat, Jan 14, 2012 at 03:23:32PM -0700, Philip Langdale wrote:
> >>Is there some combination of options that will do this or is there a
> >>software limitation
> >>I need to fix?
> >
> >IMO ideally you'd just change ffmpeg to reconfigure itself when
> >the pix_fmt changes.
> >I don't think there is any real need for it to know it until after
> >a frame was actually decompressed.
> 
> I suppose, but that seems like a fair amount of new logic. The
> fundamental
> problem is how avformat_find_stream_info is called. The codec is
> specified
> by id, even though you specify the vcodec by name. This means it
> will use
> the first decoder that matches the id. If we could pass the name in
> and then
> do a lookup by name, it should all work out.
> 
> As a bit of a hack, I did the following to set the pix_fmt from the
> user
> specified decoder and it works, but it's ugly:
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 434302d..1bd3cd4 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -3464,6 +3464,7 @@ static AVCodec *choose_decoder(OptionsContext
> *o, AVFormatContext *s, AVStream *
>      if (codec_name) {
>          AVCodec *codec = find_codec_or_die(codec_name,
> st->codec->codec_type, 0);
>          st->codec->codec_id = codec->id;
> +        st->codec->pix_fmt = *(codec->pix_fmts);

Huh? I think decoders should not have pix_fmts set, so this
should crash?
The crystalhd decoders are actually kind of wrong on this.
We probably should add a check that prints a warning when registering
a decoder that has it set so we will catch this kind of inconsistency.
So considering this you could just add a hack that checks the string
for crystalhd...


More information about the ffmpeg-devel mailing list