Log in

View Full Version : Need help to get time of frames in log.txt when using Compare funtion


lintran
3rd July 2013, 05:47
Hi everyone!
I'm using this script

V1=DirectShowSource("Video1")
V2=DirectShowSource("Video2")
Compare(V1,V2,"","log.txt")

And i got log.txt like this

Comparing channel(s) YUV

Mean Max Max
Absolute Mean Pos. Neg.
Frame Dev. Dev. Dev. Dev. PSNR (dB)
-----------------------------------------------------
0 0.1619 +0.0120 14 -12 54.5906
1 0.1713 +0.0062 14 -12 54.3706
2 0.1758 +0.0091 14 -12 54.2187
3 0.4128 +0.0368 21 -24 49.4234
4 0.3732 +0.0103 21 -34 49.6127
5 0.3533 +0.0024 23 -28 49.5742
6 0.3553 +0.0002 24 -27 49.4577
7 0.3601 -0.0007 23 -22 49.3419
8 0.3560 +0.0070 26 -24 49.3137
9 0.5092 +0.1216 29 -36 47.5593

It only have frame numbers, so what can i do to get time of frames beside frame number?
Exam
Frame number 0 --> time is: 00:00:00:000
Frame number 1000 --> time is: 00:00:02:967

Thanks so much

raffriff42
3rd July 2013, 11:14
Import into spreadsheet.
Add new column
frame time = (previous frame time) + (1 / frame rate)

https://www.dropbox.com/s/fcqrn3nmh5yt0nd/doom9%2Ct%3D168171%2C2.png?raw=1

lintran
3rd July 2013, 15:08
@raffriff42: thanks. But i want get frame time from avs script. So can you give me an avsscript?

raffriff42
3rd July 2013, 19:07
>So can you give me an avsscript?
I don't know of any way to make Compare() output frame times. What exactly are you trying to do?

raffriff42
4th July 2013, 05:29
This script fragment logs frame numbers and calculated frame times.
* Will log frames as they are served (in any order), same as Compare
* Assumes constant frame rate!
logpath="logtimes.txt"
Fn=String(FrameRateNumerator)
Fd=String(FrameRateDenominator)

## written to file when script is loaded
WriteFileStart(logpath, """ "frameno, time " """)

## written to file when a frame is served
WriteFile(logpath,
\ """String(current_frame, "%08.0f")""",
\ """ ", " """,
\ "Float(current_frame) * " + Fd + "/" + Fn)

## written to file when script is closed
WriteFileEnd(logpath, """ "#end" """)

Now all you need to do is merge the two log files.

Gavino
4th July 2013, 08:57
"Float(current_frame) * " + Fd + "/" + Fn
Instead of building the string dynamically here, you could just use
"Float(current_frame) * FrameRateDenominator / FrameRateNumerator"

raffriff42
4th July 2013, 12:18
Whoa! Thank you, Gavino.

lintran
5th July 2013, 08:01
Thanks all.