Skip to content

Frame durations not handled properly when isLastVideoFrameComplete option is not used. #171

Description

@bp2008

I discovered another fault in the fragment merging code. This is related to issue #167 where it was discovered that "SPS" and "PPS" and other NAL units could be discarded without being processed as a result of the flawed fragment merging code. It is obvious in hindsight, but the duration and compositionTimeOffset options are also being discarded. That is the subject of this issue.

The issue lies primarily in the feed functions in remuxer/h264.js and remuxer/h265.js.

Consider the case where you feed all your frames with a duration and/or compositionTimeOffset, but without the isLastVideoFrameComplete option. The last NAL unit in each data buffer (possibly an incomplete/partial NAL unit) gets stored in the this.remainingData property to be consumed later. However the duration and compositionTimeOffset options that were provided along with that data are not persisted with it.

In the common case where the last NAL unit in each data buffer is the one containing "VCL" (Video Coding Layer) data, this issue effectively causes every frame to be rendered with the wrong duration and compositionTimeOffset. Further, the very first duration and compositionTimeOffset are completely discarded. If you are monitoring the HTML5 video element's progress (e.g. via its currentTime property), it will always appear to be about 1 frame behind and its playback position may not always line up with expected frame timestamps.

An effective workaround for this is to use the new isLastVideoFrameComplete option (which disables the faulty fragment merging code), but anyone who is unaware of this new option will get video playback that kind of mostly works but has persistent timing errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions