View Full Version : Writefile & Framecount
uteotw
23rd January 2007, 14:45
Hi
I'm just trying to output the total number of frames to a text file.
So I tried:
video = avisource("test.avi")
writefile("output.txt",Framecount(video))
and
video = avisource("test.avi")
writefile(vidfeo, "output.txt",Framecount(video))
But I get a script error: Invalid argument to function "writefile"
After reading the documentation and searching this forum I'm not making any progress.
Anyone can help?
Ta
uteotw
Mr_Odwin
23rd January 2007, 14:52
Try
video = avisource("test.avi")
writefile("output.txt","Framecount(video)")
uteotw
23rd January 2007, 15:59
Thanks for your help but it didn't work either and returned the same error message, but thanks to you I tried this :
video = avisource("1.avi")
writefile(video, "output.txt","Framecount(video)")
Now, no more errors, the video can be played, but nothing is written into output.txt
Still not sure what's wrong.
Any idea?
Mr_Odwin
23rd January 2007, 16:14
This works (actually tried it myself this time):
video=AVISource("1.avi")
writefile(video,"output.txt","Framecount()")
buzzqw
23rd January 2007, 16:26
and just fyi
loadplugin("C:\Programmi\AviSynth 2.5\plugins\DirectShowSource.dll")
avisource("movie_full.avi")
Logfile="test.log"
WriteFile(Logfile, """ "Width : " """, "Width()")
WriteFile(Logfile, """ "Height : " """, "Height()")
WriteFile(Logfile, """ "FrameCount : " """, "Framecount()")
WriteFile(Logfile, """ "FrameRate : " """, "Framerate()")
WriteFile(Logfile, """ "FramerateNumerator : " """, "FramerateNumerator()")
WriteFile(Logfile, """ "FramerateDenominator : " """, "FramerateDenominator()")
WriteFile(Logfile, """ "Audiorate : " """, "Audiorate()")
WriteFile(Logfile, """ "Audiolength : " """, "Audiolength()")
WriteFile(Logfile, """ "AudiolengthF : " """, "AudiolengthF()")
WriteFile(Logfile, """ "Audiochannels : " """, "Audiochannels()")
WriteFile(Logfile, """ "Audiobits : " """, "Audiobits()")
WriteFile(Logfile, """ "IsAudioFloat : " """, "IsAudioFloat()")
WriteFile(Logfile, """ "IsAudioInt : " """, "IsAudioInt()")
WriteFile(Logfile, """ "IsRGB : " """, "IsRGB()")
WriteFile(Logfile, """ "IsRGB24 : " """, "IsRGB24()")
WriteFile(Logfile, """ "IsRGB32 : " """, "IsRGB32()")
WriteFile(Logfile, """ "IsYUY2 : " """, "IsYUY2()")
WriteFile(Logfile, """ "IsYV12 : " """, "IsYV12()")
WriteFile(Logfile, """ "IsYUV : " """, "IsYUV()")
WriteFile(Logfile, """ "IsPlanar : " """, "IsPlanar()")
WriteFile(Logfile, """ "IsInterleaved : " """, "IsInterleaved()")
WriteFile(Logfile, """ "IsFieldBased : " """, "IsFieldBased()")
WriteFile(Logfile, """ "IsFrameBased : " """, "IsFrameBased()")
WriteFile(Logfile, """ "GetParity : " """, "GetParity()")
#Trim(0,32)
BHH
uteotw
23rd January 2007, 17:54
Thanks both for your help but there is still no text being written to the output text file.
There is no error message displayed with both script, so I don't understand why it doesn't work.
I just open the avs file with VirtualDub or MediaPlayerClassic, the text file is create, I stop playing the file and close the player. But no data was written.
Do you do anything different?
buzzqw
23rd January 2007, 21:07
:confused:
if you open the script in virtualdub do you see the video ?
also... try with directshowsource and avisource
also avisynth version ?
BHH
squid_80
23rd January 2007, 23:31
Try giving the full path when specifying the filename e.g. "C:\blah\output.txt"
gzarkadas
23rd January 2007, 23:47
I just open the avs file with VirtualDub or MediaPlayerClassic, the text file is create, I stop playing the file and close the player. But no data was written.
Do you do anything different?
If you just open the avs (say in vdub) and don't dub it (push the |> button and let the entire video play) then you will not get any text ;).
Anyway, if your script is just the two lines showed in your message it should give you text output (it gave to me). If you have other lines also in your script, then you must post them all in order to be able to help you, because it is very easy to arrange things so that nothing is written out.
uteotw
24th January 2007, 02:31
so yes it's just those 2 lines I need...
and yes I can see the video...
and the winner is... squid_80 as indeed I need to enter the full path of the output text file ! Then it finaly writes the total number of frames in the video by just opening it VirtualDub. With MediaPlayerClassic you have to start playing the video.
Isn't that "limitation" some kind of bug?
Anyway thanks a lot everyone.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.