Opened 7 days ago

Last modified 3 days ago

#11190 new defect

H.264 video stops playing without errors

Reported by: kevmo314 Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords:
Cc: kevmo314, MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: The attached video does not play correctly with ffplay ffmpeg_stops_playing.ts but plays correctly if I open the file with Windows Media Player
How to reproduce: Play the attached file

$ ffplay -loglevel debug media_w254585029_503.ts
ffplay version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)

There don't appear to be any warnings or errors to indicate why it stops. The total file length is 40s. I have reproduced this with ffmpeg against master as well.

Attachments (1)

ffplay_stops_playing.ts (134.2 KB ) - added by kevmo314 7 days ago.

Download all attachments as: .zip

Change History (8)

by kevmo314, 7 days ago

Attachment: ffplay_stops_playing.ts added

comment:1 by kevmo314, 7 days ago

Digging into this, it looks like the POC is out of sequence. Specifically, ffmpeg receives a picture with order 65658 and the next picture has order 65538 which triggers ffmpeg to believe the frame is out of sequence. There is a frame number gap going from 13 -> 1 (instead of 13, 14, 15, 0, 1) however the h264 decoder doesn't seem to correctly detect this and instead ends up in a stuck state.

comment:2 by kevmo314, 7 days ago

A little more context, it looks like this file's SPS indicates that the max POC is 8192 but the POC goes from 122 to 2 reading the slice headers. It appears that FFmpeg isn't doing anything wrong then, but is there a way to ignore the POC?

I know this is used for B-frames and such, so not sure how feasible that would be. Patching this line:

out_of_order = out->poc < h->next_outputed_poc;

and replacing it with:

out_of_order = 0;

fixes playback. In other words, ignoring the out-of-order-ness of the file.

comment:3 by Balling, 6 days ago

You can use ffplay -vcodec h264_cuvid ffplay_stops_playing.ts

if you have nvidia

comment:4 by kevmo314, 6 days ago

Unfortunately we do not have the nvidia decoder and we must use the software decoder. I've submitted a proposed patch here to allow playback of these frames if specific flags are set: https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333451.html

in reply to:  5 comment:6 by MasterQuestionable, 4 days ago

Cc: MasterQuestionable added

͏    Up: https://trac.ffmpeg.org/ticket/11134#comment:7

͏    Would you kindly instruct how to properly make commits on this project?
͏    Seriously, via email..?

͏    Thanks in advance.

͏    ----

͏    Apparently using GitHub to commit is alright?..
͏    https://trac.ffmpeg.org/ticket/11181

Last edited 3 days ago by MasterQuestionable (previous) (diff)

in reply to:  5 comment:7 by kevmo314, 4 days ago

Replying to Balling:

Your patch was not applied https://patchwork.ffmpeg.org/project/ffmpeg/patch/CAGB5vbEx1eyHtfssYy-f-QO5AhHTEHMnAcEDieQOFqmcOwhfdQ@mail.gmail.com/

you need to use send-email in git

I did use git send-email to send that patch. Could you share what is missing in that email/why git send-email sent an incorrectly-formatted email?

Note: See TracTickets for help on using tickets.