yes. for the video you pointed the B-frame occurs as 6th frame, and until then has_b_frames is zero.So we assume a wrong delay of zero with my patch .
Is there some other way we can make sure that , for videos with small number of frames like 5 frames etc. DTS is filled out properly. For example if av_find_stream_info reads all of the packets of the stream and reaches EOF , then whatever the value of has_b_frames is , that is the delay and has_decode_delay_been_guessed should return true . On Mon, Mar 7, 2016 at 1:57 PM, Michael Niedermayer <mich...@niedermayer.cc> wrote: > On Mon, Mar 07, 2016 at 11:10:16AM -0800, Sasi Inguva wrote: > > Fixes DTS detection for any H264 file of less than 7 frames length. > Without this DTS is N/A. > > > > Signed-off-by: Sasi Inguva <is...@google.com> > > --- > > libavformat/utils.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/utils.c b/libavformat/utils.c > > index 5f48de1..5017937 100644 > > --- a/libavformat/utils.c > > +++ b/libavformat/utils.c > > @@ -877,7 +877,9 @@ static int has_decode_delay_been_guessed(AVStream > *st) > > avpriv_h264_has_num_reorder_frames(st->codec) == > st->codec->has_b_frames) > > return 1; > > #endif > > - if (st->codec->has_b_frames<3) > > + if (st->codec->has_b_frames == 0) > > + return st->nb_decoded_frames >= 2; > > + else if (st->codec->has_b_frames<3) > > return st->nb_decoded_frames >= 7; > > else if (st->codec->has_b_frames<4) > > return st->nb_decoded_frames >= 18; > > this looks wrong > also it breaks for example > tickets/1242/sample.mkv > try > ./ffmpeg -i sample.mkv -c:v copy -an -t 1 -f framecrc - > the DTS are wrong after this patch and there are error messages > > [framecrc @ 0x2a52ce0] Invalid DTS: 291 PTS: 209 in output stream 0:0, > replacing by guess > 0, 251, 251, 41, 4197, 0x3b9f74ad, F=0x0 > [framecrc @ 0x2a52ce0] Non-monotonous DTS in output stream 0:0; previous: > 251, current: 209; changing to 251. This may result in incorrect timestamps > in the output file. > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > In a rich man's house there is no place to spit but his face. > -- Diogenes of Sinope > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel