FFMS / ffms2

An FFmpeg based source library and Avisynth/VapourSynth plugin for easy frame accurate access
Other
576 stars 104 forks source link

[RFC] Timestamp Discontinuity Support #295

Closed dwbuiten closed 6 years ago

dwbuiten commented 7 years ago

When we index a format that is allowed to have discontinuous timestamps, try and break it down into distinct sections based on where the discontinuities occur, and reorder by PTS within them. We define a discontinuity as a packet timestamp difference that cannot possibly be frame reordering; in this case, more than 16 frames away, based on the duration of the first frame in the section. This probably breaks on insane VFR content. The correct way to do this is probably to fully decode, but that is a non-starter for a lot of usecases.

By default, we try and normalize the sections into fully continuous timestamps.

This adds a new field to the public FrameInfo struct to denote the original un-massaged PTS, and is thus an ABI break. It also adds a new field to the ffindex for this. The soversion, FFMS_VERSION, and ffindex version have been bumped.

Implements #258.

Needs a lot of testing before merging, and a close review. This is a WIP/RFC, and I am not sure the timestamp massaging code is entirely correct. I'm also not 100% sure what to do with audio.

Sample file I've been testing with: https://www.dropbox.com/s/rz6z51rxgkeo06n/test.ts?dl=0

More samples extremely welcome.

CC: @lotharkript

dwbuiten commented 7 years ago

I have just rebased this PR.

dwbuiten commented 7 years ago

Now with 100% more audio support. I'll push this in the next few days, unless there are objections.