Log in

View Full Version : Help with MDec2: Can't open video


Nick_M
29th July 2017, 02:02
I've been using MultiDecimate to remove duplicate frames. I like it a lot, but I have to downgrade the color space. MDec2 looks like I can maintain the color, but when I run it, VirtualDub gives me this error:
Avisynth open failure:
Avisynth: access violation at 0x00000000 in
C:\[...]\VirtualDub.exe,
attempting to read from 0x00000000
(T:\video\script.avs,line 12)
MultiDecimate runs the same videos just fine. What am I doing wrong?

Script (includes the lines I use for MultiDecimate):
LoadPlugin("C:\video tools\avisynth plugins\dgavcdec109\DGAVCDecode.dll")
LoadPlugin("C:\video tools\avisynth plugins\mdec2_26.dll")

#AVCSource("00274.track_4113.dga")
AVISource("sample.avi")

#ConvertToYUY2()
#MultiDecimate(pass=2)

#MultiDecimate(pass=1)

MDEC2(rate=24.0,show=false,create=false,dir="T:\video\",chroma=true,ver=false)

StainlessS
29th July 2017, 14:04
I've never had anything like that and I use it all of the time.

You have I assume run it first with Create=True (and make sure that any files remaining from MultiDecimate are deleted).

Can you also give it a try using some other app eg MPC-HC.

EDIT: which version of Avisynth are you using ?
(Make sure that if using standard 2.6 that you are NOT using an alpha version, Prior to Alpha 4 [I think] will crash
in plugins using the newer VERSION 6 avisynth.h header, which MDEC2 does).


Return Version

Nick_M
30th July 2017, 08:14
It turns out that I had Avisynth 2.6, but it was an older build. So, I was then able to run the first pass, but for pass 2, on every video I've tried, I get this error:
MDEC2: Incompatible Number of Frames
The m, c, and d files all seem ok, and they still work with MultiDecimate. The same thing happens with MPC-HC.

StainlessS
30th July 2017, 11:47
I dont exactly know how MultiDecimate does anything, the source was never released nor for the Multidecimate.Exe or ProcessMD.Exe files.

At a guess I might think that you were decimating 29.97 to 24.0, which dont work (maybe it works in MultiDecimate, i dont recall).
If above is so, suggest this (dropping 1 in 5 in MultiDecimate.Exe).

EDIT: Methinks that if you use rate=23.976, everything would be hunky dory, MultiDecimate has different arguments, and
maybe gets rate from input rate and decimation count (cant remember off hand), but you have to give correct rate in
MDec2, else it throws a wobbly.

Myself, I dont really like that 0.1% error stuff and would convert to 24FPS by correcting the source rate first.
EDIT: I also hate it when people say 24FPS when they mean 23.976 FPS, there is a difference.


LoadPlugin("C:\video tools\avisynth plugins\dgavcdec109\DGAVCDecode.dll")
LoadPlugin("C:\video tools\avisynth plugins\mdec2_26.dll")

#AVCSource("00274.track_4113.dga")
AVISource("sample.avi")
ORG=LAST # EDIT: ADDED
AssumeFPS(30.0,true)
ReSampleAudio(ORG.AudioRate) # EDIT: Added


MDEC2(rate=24.0,show=false,create=True,dir="T:\video\",chroma=true,ver=false) # Pass 1

#MDEC2(rate=24.0,show=false,create=false,dir="T:\video\",chroma=true,ver=false) # Pass 2


When MDEC2 produces the error you mention, it outputs some debug stuff to DebugView window (DebugView:- https://docs.microsoft.com/en-us/sysinternals/downloads/debugview).

here outputting debug stuff

double n = rate;
double fps = (double) vi.fps_numerator / vi.fps_denominator;
int d = 1;

while (n < 16777216 && d < 16777216) {
n*=2;
d*=2;
}

vi.SetFPS(int(n+0.5), d);

num_frames_lo = (int) (num_frames_hi * (rate/fps));
vi.num_frames = num_frames_lo;

char buf[80];
char fbuf[256];
FILE *fp;
char *p;
int line,err;
int mode,cycle,drop,num_iframes,num_oframes,oframe,iframe;
err=1;
strcpy(infile,dir);
p=infile;
while(*p)
p++;
if(p> infile && p[-1] != '\\')
*p++ = '\\';
strcpy(p,"dfile.txt");
sprintf(buf,"MDEC2: Opening file %s",infile);
OutputDebugString(buf);
if ((fp = fopen(infile, "rt")) != NULL) {
line = 1;
num_iframes = -1; num_oframes = -1;
if((fgets(fbuf, 254,fp ) != NULL)) {
for(p=fbuf;*p;++p) { // Get rid of nasty newline
if(*p == '\n') {
*p = '\0';
break;
}
}
p=fbuf;
mode=atoi(p);
while(isdigit(*p)) ++p; // Eat Digits
while(isspace(*p)) ++p; // Eat White
cycle=atoi(p);
while(isdigit(*p)) ++p; // Eat Digits
while(isspace(*p)) ++p; // Eat White
drop=atoi(p);
while(isdigit(*p)) ++p; // Eat Digits
while(isspace(*p)) ++p; // Eat White
num_iframes=atoi(p);
while(isdigit(*p)) ++p; // Eat Digits
while(isspace(*p)) ++p; // Eat White
num_oframes=atoi(p);
while(isdigit(*p)) ++p; // Eat Digits
while(isspace(*p)) ++p; // Eat White
if(num_iframes != num_frames_hi || num_oframes != num_frames_lo) {
sprintf(buf,"MDEC2: mode=%d cycle=%d drop=%d num_iframes=%d num_oframes=%d\n",mode,cycle,drop,num_iframes,num_oframes);
OutputDebugString(buf);
sprintf(buf,"MDEC2: num_frames_hi=%d num_frames_lo=%d\n",num_frames_hi,num_frames_lo);
OutputDebugString(buf);
sprintf(buf,"MDEC2: Incompatible Number of frames\n");
} else {
dec_data = (unsigned int *) malloc(sizeof(dec_data[0]) * num_frames_lo);
if (dec_data == NULL)
sprintf(buf,"MDEC2: Cannot allocate needed memory");
else
err=0;
}
} else {
sprintf(buf,"MDEC2: Cannot read File Header\n");
}


Post output of debugview, and input framerate of clip. (also what numbers are you using in MultiDecimate.Exe).
EDIT: Also, what MultiDecimate.Exe mode are you using, dont think I've ever tried anything other than
"Remove Duplicates Cycle-based Naive" mode.
EDIT: And what command are you using in Multidecimate plugin, both passes [MultiDecimate(pass=2), is that really what you are using].