Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more precise script hooks for audio-pts and playback time #13696

Open
mesvam opened this issue Mar 13, 2024 · 0 comments
Open

more precise script hooks for audio-pts and playback time #13696

mesvam opened this issue Mar 13, 2024 · 0 comments

Comments

@mesvam
Copy link

mesvam commented Mar 13, 2024

Pulled out from #13614 (comment)

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.

@mesvam mesvam changed the title more precise lua hooks for audio-pts more precise script hooks for audio-pts and playback time Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant