more precise script hooks for audio-pts and playback time
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
Pulled out from https://github.com/mpv-player/mpv/pull/13614#issuecomment-1975322056
Problem
Scripts may want to trigger an action at a precise playback time in the future. When using mp.observe_property on audio-pts, the resolution is only ~50ms realtime. Also, since the stream-time interval is ~50ms multiplied by playback speed, this problem is exacerbated, for example, when speed = 2 and the minimum interval becomes ~100ms in the audio stream.
I'm going to tentatively throw out an arbitrary goal of <1ms precision in stream-time (not in playback time), but this is negotiable so let me know if this is unrealistic for whatever reason.
Ideally, this method would be able to hook video frames as well.
Potential solution 1
If there was a way to pick an arbitrary resolution to observe audio-pts and make it not depend on playback speed that could help.
Potential solution 2
A way to add a high precision timer that executes a script function when audio-pts is greater/less than a user defined value. A corresponding property to fire for video times/frames might also be useful for similar applications.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the issue and the linked discussion in pull request #13614, focusing on the stated audio-pts observation limits and the two proposed approaches. Determine whether arbitrary-resolution observation or a high-precision timer, including possible video timing hooks, is the intended scope; done requires an agreed design and precise timing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100