[FFmpeg-devel] [PATCH] lavf/utils: has_decode_delay_been_guessed - return true if nb_decoded_frames >= 2, when there are no B-frames.

Michael Niedermayer michael at niedermayer.cc
Mon Mar 7 22:57:09 CET 2016


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 <isasi at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160307/fdfa7860/attachment.sig>


More information about the ffmpeg-devel mailing list