Log in

View Full Version : writefile function


Overdrive80
6th February 2013, 00:23
Hey, I am trying generate a txt file but writefile creates file and doesnt write nothing.

LoadPlugin("C:\Program Files (x86)\MeGUI\tools\dgindex\DGDecode.dll")
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\ColorMatrix.dll")

DGDecode_mpeg2source("C:\Users\Isra\Desktop\Bleach\VID 2\VideoFile1.d2v", info=3)

ColorMatrix(hints=true, threads=0,interlaced=true)

part1=trim(0,38811).tfm().tdecimate()
part2=trim(38812,40609)
part3=trim(40610,41089).tfm().tdecimate()

part2=part2.QTGMC( Preset="Slow", EdiMode="EEDI3", fpsdivisor=2).assumefps(part1.framerate)

WriteFile(last, "H:\xxx\001\timecodesv1.txt" ,""" "assume 29.970029", "0" """)

return part1++part2++part3

What I have do??

IanB
6th February 2013, 00:33
Your WriteFile is an orphan, move it into an active part of the graph. e.g. :-...
part2=part2.QTGMC( Preset="Slow", EdiMode="EEDI3", fpsdivisor=2).assumefps(part1)

part1++part2++part3

WriteFile(last, "H:\xxx\001\timecodesv1.txt" ,""" "assume 29.970029", "0" """)

return lastAlso to copy the exact framerate from another clip use the donor clip form of assumefps(clip, clip, bool)

Overdrive80
6th February 2013, 00:44
Thanks IanB. I have file with first line "assume ..." but zero not is writing in other line, why??

DGDecode_mpeg2source("C:\Users\Isra\Desktop\Bleach\VID 2\VideoFile1.d2v", info=3)

ColorMatrix(hints=true, threads=0,interlaced=true)

part1=trim(0,38811).tfm().tdecimate()
part2=trim(38812,40609)
part3=trim(40610,41089).tfm().tdecimate()

part2=part2.QTGMC( Preset="Slow", EdiMode="EEDI3", fpsdivisor=2).assumefps(part1.framerate)

part1++part2++part3

WriteFile(last, "H:\Bleach\001\timecodesv1.txt" ,""" "# assume 29.970029" """ , """ "0" """)


EDIT: Is necessary one invoke for each line??

EDIT2: If is necessary ^^

LoadPlugin("C:\Program Files (x86)\MeGUI\tools\dgindex\DGDecode.dll")
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\ColorMatrix.dll")

DGDecode_mpeg2source("C:\Users\Isra\Desktop\Bleach\VID 2\VideoFile1.d2v", info=3)

ColorMatrix(hints=true, threads=0,interlaced=true)

part1=trim(0,38811).tfm().tdecimate()
part2_in=trim(38812,40609)
part3=trim(40610,41089).tfm().tdecimate()

part2=part2_in.QTGMC( Preset="Slow", EdiMode="EEDI3", fpsdivisor=2).assumefps(part1.framerate)

part1++part2++part3

WriteFile(last, "H:\Bleach\001\timecodesv1.txt" ,""" "# assume 29.970029" """, append=false)

WriteFile(last, "H:\Bleach\001\timecodesv1.txt" ,""" "0," """, "part1.framecount", """ "," """, "part1.framerate")

WriteFile(last, "H:\Bleach\001\timecodesv1.txt" , "part1.framecount+1", """ "," """ , "part1.framecount+part2.framecount-1", """ "," """,

"part2_in.framerate")

WriteFile(last, "H:\Bleach\001\timecodesv1.txt" , "part1.framecount+part2.framecount", """ "," """ , "part1.framecount+part2.framecount

+part3.framecount-1", """ "," """, "part3.framerate")

Gavino
6th February 2013, 11:25
I have file with first line "assume ..." but zero not is writing in other line, why??

EDIT: Is necessary one invoke for each line??
Yes, each call to WriteFile writes all its arguments on a single line.

Note that WriteFile() writes a line to the file for every rendered output frame.
Since the information you are writing is fixed (not frame-dependent), I suspect you should be using WriteFileStart (http://avisynth.org/mediawiki/WriteFileStart)() instead. This writes the information once only, during script loading.

Also, as IanB suggested, you should use assumefps(part1) instead of assumefps(part1.framerate) as the latter is not necessarily exact.