Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th August 2006, 00:47   #1  |  Link
wuziq
Registered User
 
Join Date: Feb 2004
Posts: 23
writefile not working?

writefilestart works for me, but the other writefile functions do not work. By "do not work", I mean that a text file gets created but nothing gets written into the file. I have tried doing "Scan video for errors", playing the whole clip through, even compressing it.

Examples that do not work:

Code:
filename = "test.txt"
clip = blankclip()
writefile(clip, filename, "current_frame", append=true, flush=true)
Code:
filename = "test.txt"
clip = blankclip()
writefileend(clip, filename, """ "goodbye" """, append=true)
Code:
filename = "test.txt"
clip = blankclip()
writefileif(clip, filename, "I CAN PUT ANYTHING HERE AND I GET NO ERRORS OR COMPLAINTS AT ALL", "current_frame")
Do I need to do anything in particular to get them to work?


Example of what works:

Code:
filename = "test.txt"
clip = blankclip()
writefilestart(clip, filename, """ "hello" """)
I am using AviSynth v2.5.6, WinXP.. I tried both vdub and vdubmod.. any other info that I need to put here, let me know.

I sense I might be doing something fundamentally wrong.. but, even with the simplest case of writefileend, it doesn't work, while writefilestart does. Anyone experiencing these problems?

Last edited by wuziq; 12th August 2006 at 00:51.
wuziq is offline   Reply With Quote
Old 14th August 2006, 06:28   #2  |  Link
wuziq
Registered User
 
Join Date: Feb 2004
Posts: 23
bump.. any ideas, anyone?
wuziq is offline   Reply With Quote
Old 14th August 2006, 06:49   #3  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
dunno, it seems to work for me with this script:

Code:
angle1=mpeg2source^("%~dpn1.d2v",idct=7,cpu=0^)

angle2=mpeg2source^("%~dpn2.d2v",idct=7,cpu=0^)

mt_lutxy^(angle1,angle2,expr="x y - abs",y=3^)
WriteFileIf^(last, "%~dp1\differences.txt", "yplanemax(.5) > 16", "current_frame", """ ":" """, "yplanemax(.5)"^)
perhaps there's some weird permissions going on in the folder you're writing to? probably not seeing as a file is being created.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 14th August 2006, 16:53   #4  |  Link
wuziq
Registered User
 
Join Date: Feb 2004
Posts: 23
yeah it is really weird, and frustrating. originally i was doing it over a network folder, which didn't work.. but i did the same thing on a local drive, and still no go. and you're right, it's not a permissions thing because i have full access to the drives.. and yeah, the text file IS being created, it's just nothing is getting written into it (with the exception of when i use writefilestart). anyway, thanks for trying it out.. if anyone else has any ideas, i'd really appreciate it. thanks
wuziq is offline   Reply With Quote
Old 15th August 2006, 00:18   #5  |  Link
wuziq
Registered User
 
Join Date: Feb 2004
Posts: 23
i think i figured out my problem.

it's not possible to use writefile on a clip that is not the final returned clip, correct? IS there a way for that to work?
wuziq is offline   Reply With Quote
Old 15th August 2006, 01:18   #6  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
When it's outside the processing chain, as far as avisynth is concerned it doesn't exist (mostly...). Anything that inserts it will work. Something as simple as:
Code:
Avisource("...")
clip=Blankclip()
clip=clip.writefile(clip, filename, "current_frame", append=true, flush=true)
#this will still return avisource at this point and ignore clip
MergeChroma(clip).MergeChroma(last)
#now it will process clip
should do the trick.

(I never knew about the flush=true, I thought you always had to close first... I guess sometimes I need to rtfm too. )
foxyshadis is offline   Reply With Quote
Old 12th September 2012, 15:53   #7  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Just to give some closure to this old thread...

I ran into this exact problem and it wasn't due to the clip not being rendered as described here. It was simply that WriteFile() and its variants do not work in Avisynth 2.57. Everything is fine in 2.58 and beyond. That, at least, is my experience.
Guest is offline   Reply With Quote
Old 12th September 2012, 18:12   #8  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by neuron2 View Post
WriteFile() and its variants do not work in Avisynth 2.57.
I seem to recall there was a problem in 2.57 unless you used an absolute pathname for the file.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th September 2012, 19:16   #9  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Ah, could very well be, as I didn't have a full path. I'll try again with 2.57 and full path just for grins when I get home and then finally close this thread out.

I'm a bit doubtful though as the WriteFileStart() works.
Guest is offline   Reply With Quote
Old 12th September 2012, 23:16   #10  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
The problem was to do with the flush option, relative paths and changing CWD. The significant change was at line 332 in the diff of conditional_reader.cpp 1.9 to 1.10. The other changes to show the "filename" in play made what was happening obvious.
IanB is offline   Reply With Quote
Old 13th September 2012, 00:41   #11  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
I confirm that using a full path for the output file makes 2.57 work properly.
Guest is offline   Reply With Quote
Old 25th November 2012, 23:04   #12  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Same problem here, using avisynth ver 2.58

Quote:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePan.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePanEstimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FluxSmooth.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\deflicker.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\degrainmedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\degrainmedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FFT3DFilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Descratch.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Decomb.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ac3source.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\cnr2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\badframes.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\autolevels.dll")

# MASK DLLs

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\variableblur.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ChromaShift.dll")


video=AVISource("C:\Documents and Settings\main\My Documents\TC_sample.avi")

last = video

o = last

filename = "c:\myprojects\output.txt"

# WriteFile(o, filename, "current_frame", "AverageLuma")

oo = o
oo = info(oo)
oo

WriteFile(filename, "current_frame")

# this line is written when the script is opened
WriteFileStart(filename, """ "This is the header" """)

# and this when the script is closed
WriteFileEnd(filename, """ "Now the script was closed" """)


oo.ConvertToRGB()


it doesn't write anything but the headers.

The version() example works
lisztfr9 is offline   Reply With Quote
Old 25th November 2012, 23:31   #13  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by lisztfr9 View Post
it doesn't write anything but the headers.
See http://avisynth.org/mediawiki/WriteFile
Quote:
Originally Posted by Writefile
Note that since output is produced only for rendered frames, there will be no output at all if the result of the filter is not used in deriving the final result of the script.
In your script, the result of the Writefile() call (which is implicitly assigned to 'last') is not used, since the script returns oo.ConvertToRGB().

You need to change the Writefile() line to
oo = oo.WriteFile(filename, "current_frame")
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 25th November 2012 at 23:37.
Gavino is offline   Reply With Quote
Old 26th November 2012, 10:01   #14  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Ok.... i past only 2 hours on that.

However the headers are printed, which is leading to some confusion...

"oo = oo.WriteFile(filename, "current_frame") "

I didn't want to do that because the output in my mind was a log file, not a clip...

Ok the result is assigned to last... not to oo ! this is specific to avisynth syntax, that the result name can differ from the input name.

Edit :
Hurray ! this is the proof :
Quote:
oo = o
info(oo)
oo = last

Last edited by lisztfr9; 26th November 2012 at 10:06.
lisztfr9 is offline   Reply With Quote
Old 26th November 2012, 10:21   #15  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by lisztfr9 View Post
However the headers are printed, which is leading to some confusion...
WriteFileStart and WriteFileEnd, which produce the headers/footers, operate differently from WriteFile.
They generate output only on script opening and closure respectively, not for each frame rendered. So they will produce output even if the filter itself does not deliver any frames to the final script result.

Quote:
Ok the result is assigned to last... not to oo ! this is specific to avisynth syntax, that the result name can differ from the input name.
That's right.
SomeFilter(c)
does not change the value of c. Instead, it is equivalent to
last = SomeFilter(c)
If you want the result to be assigned to c, you need to do it explicitly:
c = SomeFilter(c)

See http://avisynth.org/mediawiki/Grammar.
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 26th November 2012 at 10:24.
Gavino is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.