PDA

View Full Version : Need help with WriteFile


xdcdx
26th October 2005, 18:42
This simple script, shows the video when opened in virtualdub, but doesn't write any info to 'luma.txt', it just remains as a 0kb file. If I delete the file, and reopen the script, the file gets created again, but nothing written. Removing 'append' and 'flush' makes no difference. What's wrong?

vob = mpeg2source(d2v="VTS_01_1.d2v", cpu=4, info=0, idct=3, showQ=false)
WriteFile(vob, "luma.txt", "current_frame", append = true, flush = true)
return vob

As a side note, I'm doing this because I'm trying to pinpoint advertisement cuts in this video, without having to manually check it. So I want to write AvergaLuma values to a file to look for white screens (and black ones).

Thanks,
xDCDx

Elic
26th October 2005, 20:56
Hmm. Avisynth scripts run from bottom to top, i.e. return vob runs first and ask for frame (s) from clip vob, and then mpeg2source() runs and puts frame into vob. So WriteFile() doesn't run at all :(

Try rewrite last line as
return

Wilbert
26th October 2005, 21:36
Try

mpeg2source(d2v="VTS_01_1.d2v", cpu=4, info=0, idct=3, showQ=false)
WriteFile("luma.txt", "current_frame", append = true, flush = true)