[Ffmpeg-devel] [PATCH] DVR-MS probe audio format - was DVR-MS bug (MP2 decoding)

John Donaghy johnfdonaghy
Wed Mar 14 20:47:10 CET 2007

> >              if (type == CODEC_TYPE_AUDIO) {
> >                  get_wav_header(pb, st->codec, type_specific_size);
> > +                if (test_for_ext_stream_audio) {
> > +                    // codec_id is unreliable in dvr_ms files
> > +                    // set it later by probing stream
> > +                    st->codec->codec_id = -1;
> wont this break EVERY audio format except mp3 and ac3?

Maybe - I'm not sure if there's any other way that
'test_for_ext_stream_audio' could be 'true' at this point. To be safer
I could have defined a new flag that is set to 'true' only when the
dvr-ms audio stream header is detected in the extended stream header
because that is the only header with the problem. Then I would use the
new flag in the above 'if' statement instead. (According to M$ dvr-ms
audio is only ever either MP2 or AC3 because that is how it is

> > +    s->streams[stream_num]->codec->codec_tag = 0;
> > +    av_free(pd.buf);
> > +
> > +    url_fseek(&s->pb, pos, SEEK_SET);
> > +    asf_reset_header(s);
> uhm, i dont think this will work ...
> try ffmpeg -f asf - test.avi <in.asf

Do you mean setting the codec_tag to zero wont work? If so then you're
right - it only worked in mplayer because the lavf demuxer handles the
case. How about this line instead which appears to work:

    s->streams[stream_num]->codec->codec_tag =

("Work" is an exaguration though because I get this message with or
without my patch when I run ffmpeg -f asf test.avi -i dvr-ms-file:

Stream #0.1: Video: mpeg2video, yuv420p, 720x576, 15000 kb/s, 25.00 fps(r)
picture size invalid (0x0)

> you could call a probe routine like that from av_find_stream_info() which
> will take care of buffering all packets for you
Are you suggesting extending av_find_stream_info to generally handle
the case where the  audio codec is unknown by probing it and
attempting to identify it that way?


More information about the ffmpeg-devel mailing list