ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
212 stars 53 forks source link

Audio & video timestamp delay #356

Closed brabebhin closed 1 year ago

brabebhin commented 1 year ago

This adds support for altering the presentation timestamp of samples. Allows audio and video stream synchronizations.

brabebhin commented 1 year ago

Hi @lukasf

I implemented your suggestions from #355

So regarding playback, this seems to have absolutely no effect on audio-only streams. Media Foundation seems to ignore the offset. At least from what I can tell.

Seems to work well for video, although the video stream also locks out until audio catches up.

I'm also going to try some other approaches as and see how it pans out.

brabebhin commented 1 year ago

I was actually just about to suggest unifying the subtitles delay API lol. You beat me to it.

I had a look at the old subtitles delay API, and I think we can save some of it:

  1. The SetSubtitleDelay works by settings the delay for all subtitle streams. This might prove useful.
  2. The new StreamDelay API works by setting per individual subtitle stream. This is a superset of the first, so the SetSubtitleDelay can call into this one, simplifying our internal API. It is also technically a tad harder to use than the existing API.
  3. I think we can safely deprecate the GetSubtitleDelay - this one makes little sense when you can modify per stream. This API is actually quite dangerous once we merge this new one.
lukasf commented 1 year ago

Agreed to all points.