LC send -1000/sec ticks , Quicktime play - 600 frames/sec

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
erikhans08
Posts: 87
Joined: Wed Mar 25, 2015 2:01 am

LC send -1000/sec ticks , Quicktime play - 600 frames/sec

Post by erikhans08 » Fri Oct 23, 2015 4:44 pm

Does anyone have an example of using the send in time command (1000 ticks/sec) with QuickTime's 600 frames/sec to co-ordinate LC animation with QT sound? Or using the move command with QT? I do ha(v|b)e derBrill's animation engine but am just learning how to use it.
Thanks,
Erik Hansen

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: LC send -1000/sec ticks , Quicktime play - 600 frames/se

Post by Klaus » Fri Oct 23, 2015 5:11 pm

Hi Erik,

just to be sure:
60 ticks = 1 second
And QuickTime movies usually never have 600 frames per second, that is only the TIMESCALE,
which is not the framerate!, of most QT movies!


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: LC send -1000/sec ticks , Quicktime play - 600 frames/se

Post by dunbarx » Fri Oct 23, 2015 5:30 pm

Hi.

If you use "milliseconds", you can get your 1000/second, or any other value, but know that these are not precisely timed, being dependent on all sorts of other machine processes. So you likely cannot sync such events with anything that has its own sense of timing.

Unless that does not matter much with the QT thing you are considering.

Craig Newman

erikhans08
Posts: 87
Joined: Wed Mar 25, 2015 2:01 am

Re: LC send -1000/sec ticks , Quicktime play - 600 frames/se

Post by erikhans08 » Sat Oct 24, 2015 5:19 pm

Right, millis. For a teaching video even a rough approximation is good.
Along with the LiveCode Dictionary I have been studying http://lessons.runrev.com/m/4603/l/44283-using-players.

Here is what they say about timescale:
"timeScale (labeled as "Units/sec") - a read-only property that gives the time scale of the currently-loaded movie in number of frames per second. Most QuickTime video movies have a rate of 600 frames per second."
Put (the timescale of player "player 1" of stack "players") shows 1000.
Not sure how I managed to get 1000 but my startTime and endTime are working with the timescale equaling the millis.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: LC send -1000/sec ticks , Quicktime play - 600 frames/se

Post by bn » Sat Oct 24, 2015 7:10 pm

Timescale has nothing to do with frames per seconds.

Timescale is an internal referencing scale to what everything else relates. You find mov with varying timescales mostly 600, I have seen numbers lower than that. A timescale of 1000 has the advantage that it is easier to calculate then the other ones when converting to min:sec:ms

The framerate is independently set from timeScale. Timescale in this setting tells the application how fast and how long to display a frame. A timescale is especially important when sychronizing audio/movie/sprites in one mov.

To convert duration and currentTime to Sec:ms you can use this

Code: Select all

on mouseUp
   put  the currentTime of player 1 into tCurTime
   put  the duration of player 1 into tDur
   put  the timeScale of player 1 into tTS
   set the numberformat to ".000"
   put  "CurrentTime in timeScale " & tCurTime & cr & "Duration in timescale " & tDur & cr & "TimeScale " & tTS into field "fRes"
   put cr & "CurrentTime in Sec:ms " & tCurTime/tTS & cr & "Duration in Secs:ms " & tDur/tTS after field "fRes"
end mouseUp
No way to get the framerate from this. If you know how many frames you have (e.g. you made your movie from images) and you know the duration of the movie in timeScale then you could calculate the framerate.

So
"timeScale (labeled as "Units/sec") - a read-only property that gives the time scale of the currently-loaded movie in number of frames per second. Most QuickTime video movies have a rate of 600 frames per second."
is not correct.

Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: LC send -1000/sec ticks , Quicktime play - 600 frames/se

Post by bn » Tue Oct 27, 2015 9:48 pm

"timeScale (labeled as "Units/sec") - a read-only property that gives the time scale of the currently-loaded movie in number of frames per second. Most QuickTime video movies have a rate of 600 frames per second."
I contacted the author of that text and he will rework it.

It is not from the lesson: using-players.

Kind regards
Bernd

erikhans08
Posts: 87
Joined: Wed Mar 25, 2015 2:01 am

Re: LC send -1000/sec ticks , Quicktime play - 600 frames/se

Post by erikhans08 » Sun Mar 20, 2016 1:18 pm

Thanks for the information. To be specific:
I run .mp4 and .mov clips of dance routines of 3 to 6 minutes in a player control in their own stack, "Players".
Another stack "Choreographer" represents formation dancers as in ballroom or folkloric dancing.
Both stacks can be visible at the same time, splitting the screen.
"Choreographer" is the name of the application. LiveCode Community, public domain.

Choreographer's buttons have icons with images of dancers
facing here and there and graphic arrows pointing to the next position.
I call each position an event. "100,100,4001" for "x,y,icon".
Generally one "event" per 4 bar phrase but it could be one per bar, one per beat or anything consistent.
You can step through the events (with arrows) or use animation:
"move button theDancer of stack "Choreographer" from thePrev_X,thePrev_Y to the_X,the_Y /
in theMillisecondsPerMove milliseconds without waiting // ???"
Although the movement is strictly linear (X1,Y1 to X2,Y2) it looks curvilinear and realistic.

Using player callbacks I should be able to show a new still screen every for each 4 bars of video.
I would like to sync the "move" commands with the music from mp4 or wav videos for LiveCode animation.
Someone must have done this sort of thing before. Are there examples of such code?

Thanks,

Erik Hansen

Post Reply