movieGL::seekToTime() works with 1sec precision


#1

Hello all!

The problem is as topic header:
seekToTime works with whole seconds precision.
By the way - seekToFrame does not work at all.
Anybody seen this problem before?


#2

Hi,

I’m not too sure about this, but I think seekToTime() will jump to the nearest key frame of the movie. If the movie only has one key frame per second, the seek resolution is indeed 1 second. If all frames are key frames, you can seek to every frame.

-Paul


#3

Thank you for answer, Paul.
Movie is ProRES MOV movie, it’s has no key frames. ProRES uses intra-frame compression(not inter-frame), and it does not need key frames.
I’ve googled seekToTime and found that AVPlayer uses CMTime with timeScale parameter, which is how many fractions are in 1 sec. In cinder seekToTime() works like it has timeScale set to 1. But in cinder SeekToTime() has no parameter timeScale.
In QuickTimeImplAvf.mm there is a code:

CMTime seek_time = CMTimeMakeWithSeconds(seconds, [mPlayer currentTime].timescale);
[mPlayer seekToTime:seek_time toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];

timescale is taken from mPlayer, which is of AVPlayer* type. But there is no access to AVPlayer class in cinder (MovieBase has getPlayerHandle(), but it’s not possible to access members of returned object).
Is there a way to access it? Or, may be problem is somewhere outside of AVPlayer?


#4

Coming across this thread and I had a similar problem where timescale always seemed to be at 1. It brought me to this site which helped me understand timescale https://warrenmoore.net/understanding-cmtime. In the end I did a little hack and changed the implementation in QuickTimeImplAvf.mm Anywhere it references “timescale” I just hard coded the number 600 and then recomplied cinder with that. Not a great long term solution, but it helped in my one specific situation.


#5

I’ve found it in .mm file, but didn’t now that I need to recompile cinder :(((
Sorry for stupid question - how to recompile cinder? Would you share link please? XCode I mean


#6

See this guide:
https://libcinder.org/docs/guides/git/index.html


#7

Ok, going to read.
Thank you!