Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ofVideoPlayer AVFoundation, setPosition can work with arbitrary frames. #8189

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

Open
dimitre wants to merge 9 commits into openframeworks:master
base: master
Choose a base branch
Loading
from dimitre:avplayer

Conversation

@dimitre
Copy link
Member

@dimitre dimitre commented Nov 13, 2024

by lowering seekToTime tolerance to zero it will force the video frame to be displayed correctly.

Today if I load a video recorded with a camera, lets say Sony alpha 6500 in h264, it makes one keyframe each second.
if I'm trying to setPosition in an arbitrary position it will only display one frame per second (the keyframe)

with this change we assure it will be positioned in the correct frame even if it takes more cpu cycles to calculate (in the case of random access or backwards access).
it doesn't change anything for normal play because frame difference will be accumulating.

quick way of testing

	float pos = ofMap(mouseX, 0, ofGetWindowWidth(), 0, 1);
	video.setPosition(pos);
	video.update();

artificiel reacted with thumbs up emoji
@dimitre dimitre marked this pull request as ready for review November 13, 2024 17:21
Copy link
Contributor

it's great to be able to do that!

however it might also be good to have the option to maintain the current (default) to retrieve only keyframes as inter-frame decode presumably takes more CPU it will change the performance of existing code. ex:

video.setTolerance(ofVideoPlayer::TOLERANCE_ZERO);
video.setTolerance(ofVideoPlayer::TOLERANCE_INFINITY); // historical default

Copy link
Member Author

dimitre commented Nov 14, 2024

We can optionally expose something like that if it is useful
I can only see a setPosition that just works.
the historical implementation is not good, I know people gave up using videoPlayer on macOS (which performs great btw)

Copy link
Member Author

dimitre commented May 3, 2025

@ofTheo greattt news about the release!
take a look at this one when you have time
I know a project was moved from OF to another platform because of this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /