breaking currentTime into minutes, seconds, and frames
Josh Mellicker
josh at dvcreators.net
Fri Apr 14 15:29:07 EDT 2006
FYI, here is the code for displaying the time of a Quicktime movie in
HH:MM:SS:fractions:
(this is a button script)
ON mouseUp
IF the paused of player "Player" is false THEN
stop player "Player"
set the numberFormat to "##"
put the currentTime of player "Player" into this_time
put the timeScale of player "Player" into movie_scale
put this_time div movie_scale into total_seconds
put this_time mod movie_scale into partial_seconds
put total_seconds div 3600 into hours2
put total_seconds div 3600 into hours1
put (total_seconds - (hours2 * 3600)) div 60 into minutes1
put (total_seconds - (minutes1 * 60)) div 1 into seconds1
put cr & cr & "time: " & hours1 & ":" & minutes1 & ":" &
seconds1 & "." & partial_seconds & " - " after fld "notes"
select after text of fld "notes"
set the label of me to "start movie again"
ELSE
set the label of me to "stop movie and take note"
start player "Player"
END IF
END mouseUp
This is working great... except for ONE THING (isn't there always
that ONE THING... ;-)
The fractional seconds (partial_seconds) is coming out as a variable
digit number:
time: 00:00:01.217 -
time: 00:00:02.367 -
time: 00:00:04.99 -
time: 00:00:05.398 -
time: 00:00:07.08 -
time: 00:00:08.237 -
So finally, my question is:
Is there any way to determine the FRAME RATE of a QT movie?
That way, I could display true frame numbers...
Otherwise, how come, once I set the numberFormat to "##" are those
numbers coming out 3 digits sometimes?
Thanks,
Josh
On Feb 13, 2006, at 6:47 PM, Josh Mellicker wrote:
> I kind of figured it out.
>
> By the way, the purpose of the app is to load a QT movie, then
> allow the user to easily and efficiently take notes, tagged with
> the current movie time.
>
> If this is of any use to anyone:
>
> Make a card with:
>
> 1. a Player object
>
> 2. a "get new movie" button
>
> 3. a "stop movie and take note" button.
>
>
> Here is my script for the "start/stop" button:
>
> ON mouseUp
> IF the paused of player "Player" is false THEN
> stop player "Player"
> set the numberFormat to "##"
> put the currentTime of player "Player" into curTime
> put (curTime - (curTime mod 1800))/1800 into curMin
> put (curTime mod 1800)/30 into curSec
> put cr & "time: " & curMin & ":" & curSec & " - " after fld
> "notes"
> select after text of fld "notes"
> set the label of me to "start movie again"
> ELSE
> set the label of me to "stop movie and take note"
> start player "Player"
> END IF
>
> END mouseUp
>
>
> Here's what the output looks like:
>
> ________________________________________
> movie: aeps_05_c1_final.mov
> timescale: 30
> ________________________________________
>
> time: 00:05 - white rect
>
> time: 00:15 - arrows
>
> time: 00:21 - title with bullet points
>
> time: 00:55 - white rect left side
>
> time: 00:57 - WR right side
>
> time: 01:07 - like the tooltip! awesome! :D
>
> time: 01:43 - power tip anim
>
>
>
>
>
> "get new movie" button:
>
> ON mouseUp
> IF the paused of player "Player" is false THEN
> set the paused of player "Player" to true
> END IF
>
> answer file "Please choose a movie:"
> set the filename of player "Player" to it
> set the itemDelimiter to "/"
> put cr & cr & "________________________________________" after
> fld "notes"
> put cr & "movie: " & the last item of it after fld "notes"
> put cr & "timescale: " & the timeScale of player "Player" & cr
> after fld "notes"
> put "________________________________________"after fld "notes"
>
> END mouseUp
>
>
> If your job is to watch movies and make comments at certain points,
> this is the app for you!
>
> It is pretty lame right now, but with a little work...
>
> Anyway, let me know if anyone would like the actual stack, I can
> upload it.
>
>
>
>
> On Feb 13, 2006, at 3:19 PM, Josh Mellicker wrote:
>
>> I'm sure this has been done so many times so I thought I would
>> ask. (I've searched everywhere I can find)
>>
>> When getting currentTime of a QT movie, you get an integer which
>> is the current frame.
>>
>> This gets minutes:
>>
>> put "minutes: " & (curTime - (curTime mod 1800))/1800 into curMin
>>
>> What I'm trying to get is:
>>
>>
>> mm:ss:ff
>>
>> minutes:seconds:frames
>>
>> (like: 1:34.23)
>>
>>
>> My brain hurts.
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
More information about the use-livecode
mailing list