Log in

View Full Version : avs2yuv.exe v0.24 and TFM()


PhilR
25th March 2009, 22:38
I was trying to use TFM with the output option under avs2yuv.exe, but the stats file was always empty.

The reason is that TFM doesn't write out the statistics file until its destructor is invoked. avs2yuv never deletes its IScriptEnvironment, so this never occurs.

Here is one possible fix:

--- avs2yuv.cpp.orig.cpp 2009-03-25 14:36:08.417734300 -0700
+++ avs2yuv.cpp 2009-03-25 14:23:34.209782400 -0700
@@ -10,6 +10,7 @@
#include <string.h>
#include <io.h>
#include <fcntl.h>
+#include <memory>
#include "internal.h"

#ifdef _MSC_VER
@@ -113,7 +114,7 @@
if(!CreateScriptEnvironment)
{fprintf(stderr, "failed to load CreateScriptEnvironment()\n"); return 1;}

- IScriptEnvironment* env = CreateScriptEnvironment(AVISYNTH_INTERFACE_VERSION);
+ std::auto_ptr<IScriptEnvironment> env(CreateScriptEnvironment(AVISYNTH_INTERFACE_VERSION));
AVSValue arg(infile);
AVSValue res = env->Invoke("Import", AVSValue(&arg, 1));
if(!res.IsClip())
@@ -197,7 +198,7 @@
frm = inf.num_frames-1;
}

- PVideoFrame f = clip->GetFrame(frm, env);
+ PVideoFrame f = clip->GetFrame(frm, env.get());

if(out_fhs) {
static const int planes[] = {PLANAR_Y, PLANAR_U, PLANAR_V};

Chikuzen
4th July 2011, 14:39
@PhilR
Thanks! Your patch solved this issue (http://doom10.org/index.php?topic=199.msg4126#msg4126) :D

I applied your patch and some cosmetics to original avs2yuv0.24.

avs2yuv-0.24m (http://www.mediafire.com/download.php?ci6b597547yuxcj) (This binary requires msvcr100.dll)

sourcecode (https://github.com/chikuzen/avs2yuv)

*fix crash on Windows7 when closing process.
*change the tool for -hfyu from mencoder to ffmpeg.

MasterNobody
4th July 2011, 19:45
Some time ago I decided to compile avs2yuv in GCC (didn't want to install MSVS) so I replaced C++ code with C (based on AviSynth input from x264).
May be somebody will find it useful: avs2yuv-0.24-mod.zip.zip (http://www.mediafire.com/?6w4jte3w5e2zk9t)

Chikuzen
6th July 2011, 03:58
@MasterNobody
Your code doesn't work at all...:(

g:\Enctools> echo ColorBars^(^).Trim^(0,999^) > ./in.avs

g:\Enctools> .\avs2yuv_ch.exe .\in.avs -o .\out1.y4m
.\in.avs: 640x480, 30000/1001 fps, 1000 frames
converting RGB -> YV12

g:\Enctools> .\avs2yuv_bm.exe .\in.avs -o .\out2.y4m
(null)

MasterNobody
6th July 2011, 07:15
Chikuzen
Hm. It is strange. It works for me (Windows XP 32-bit + AviSynth 2.5.8) and your version doesn't work due dependecy on msvcr100.dll (I don't have it on my system).

MasterNobody
6th July 2011, 08:01
Try this version avs2yuv-0.24-mod.zip (http://www.mediafire.com/?thjl3v9iaopv86b) (may be one of the used functions doesn't exist in msvcrt.dll of your OS)

Groucho2004
6th July 2011, 09:33
@PhilR
Thanks! Your patch solved this issue (http://doom10.org/index.php?topic=199.msg4126#msg4126) :D

I applied your patch and some cosmetics to original avs2yuv0.24.

avs2yuv-0.24m (http://www.mediafire.com/download.php?ci6b597547yuxcj) (This binary requires msvcr100.dll)

sourcecode (https://github.com/chikuzen/avs2yuv)

*fix crash on Windows7 when closing process.
*change the tool for -hfyu from mencoder to ffmpeg.

I'm curious about a couple of things:

In your avisynth.h, AVISYNTH_INTERFACE_VERSION has the value "2". Why did you change that?

Also, why don't you remove the dependency to msvcr100.dll by simply linking statically?

Edit: Sorry, I just noticed that the original avisynth.h that Loren Merrit included is a very old one. So, you actually didn't change it. I guess I was thrown off by the comment in your code repository that you updated to a more recent version (which you didn't). :)

Chikuzen
6th July 2011, 09:40
Try this version avs2yuv-0.24-mod.zip (http://www.mediafire.com/?thjl3v9iaopv86b) (may be one of the used functions doesn't exist in msvcrt.dll of your OS)

still doesn't work...:(

btw, this is static-link version of mine.
http://www.mediafire.com/download.php?zhl0044zbhfaigy

Chikuzen
7th July 2011, 16:48
Also, why don't you remove the dependency to msvcr100.dll by simply linking statically?


Because I think that Microsoft says "You shouldn't link CRT statically to your program except when there is a special reason"
http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.80%29.aspx

Groucho2004
7th July 2011, 17:03
Because I think that Microsoft says "You shouldn't link CRT statically to your program except when there is a special reason"
http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.80%29.aspx

I prefer static linking, especially when it comes to such tiny utilities where the size argument is irrelevant.

Gavino
7th July 2011, 17:07
I prefer static linking, especially when it comes to such tiny utilities where the size argument is irrelevant.
But it's precisely with tiny utilities that statically linking the RTL leads to a huge (relative) increase in filesize.

(Sorry to contradict you for the 2nd time today. :))

Groucho2004
7th July 2011, 17:16
But it's precisely with tiny utilities that statically linking the RTL leads to a huge (relative) increase in filesize.

(Sorry to contradict you for the 2nd time today. :))

No problem. :)

I'll give you an example:
avs2yuv compiled with VC8 (VC2005) and statically linked gives me a file size of 94,208 bytes.
If you consider this huge I suggest you look at recent versions of Adobe Reader. :):):)

MasterNobody
7th July 2011, 18:32
Chikuzen
This was really stupid bug (my bad I didn't test it with AviSynth 2.6.0). This time it should work for sure. avs2yuv-0.24-mod-fixed.zip (http://www.mediafire.com/?4f9xbok7knoz3cz)

verisokin
29th April 2013, 07:21
Chikuzen
This was really stupid bug (my bad I didn't test it with AviSynth 2.6.0). This time it should work for sure. avs2yuv-0.24-mod-fixed.zip (http://www.mediafire.com/?4f9xbok7knoz3cz)

Link died.
Please create a new one.
http://forum.doom9.org/showthread.php?t=148782
I would like a new version Avisynth 2.6 MT