Opened 2 months ago

Last modified 6 weeks 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 2 months ago.

Download all attachments as: .zip

Change History (9)

by kevmo314, 2 months ago

Attachment: ffplay_stops_playing.ts added

comment:1 by kevmo314, 2 months 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, 2 months 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, 2 months ago

You can use ffplay -vcodec h264_cuvid ffplay_stops_playing.ts

if you have nvidia

comment:4 by kevmo314, 2 months 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, 8 weeks 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.

Version 0, edited 8 weeks ago by MasterQuestionable (next)

in reply to:  5 comment:7 by kevmo314, 8 weeks 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?

comment:8 by Gyan, 6 weeks ago

It may be your repo tree wasn't clean, or fast-forwardable on top of master.

Note: See TracTickets for help on using tickets.