Log in

View Full Version : error opening an .avs with AvisynthWrapper.cs


jd1990
30th June 2011, 20:59
hi everyone.

well, I have got to do work AvisynthWrapper.cs but when i try to change of frames I get this error

http://i53.tinypic.com/24mffhj.jpg
dunno what it can be :(
Does someone know what this error means?

here the code what i'm using

public partial class Form1 : Form
{
private Bitmap bitmap = null;
private AviSynthClip asc = null;

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
// string filename = @"C:\Users\Administrador\Documents\test\test.avs";
char c = '"';
string p1= @"C:\Users\Administrador\Documents\x264\dgindexnv\DGDecodeNV.dll";
string p2 = @"C:\Users\Administrador\Documents\MTVNHD.dgi";
string parce = "loadplugin("+c+p1+c+")" + Environment.NewLine + "DGSource("+c+p2+c+")";
AviSynthScriptEnvironment asse = new AviSynthScriptEnvironment();
asc = asse.ParseScript(parce);
int suma = Convert.ToInt32(textBox1.Text) + 1;
textBox1.Text = suma.ToString() ;
bitmap = ReadFrameBitmap(asc, suma);

pictureBox1.Image = bitmap;
pictureBox1.Width = asc.VideoWidth;
pictureBox1.Height = asc.VideoHeight;
}

public Bitmap ReadFrameBitmap(AviSynthClip asc, int position)
{
Bitmap bmp = null;
try
{
bmp = new Bitmap(asc.VideoWidth, asc.VideoHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
bmp.PixelFormat);
try
{
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Read data
asc.ReadFrame(ptr, bmpData.Stride, position);
}
finally
{
// Unlock the bits.
bmp.UnlockBits(bmpData);
}
bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
return bmp;
}
catch (Exception)
{
if (bmp != null) bmp.Dispose();
throw;
}
}

}


plz help me!!

Guest
30th June 2011, 21:25
Do you have an Nvidia card and do you have a license for DGDecNV?

What do you mean by "when i try to change of frames"?

jd1990
30th June 2011, 22:07
Do you have an Nvidia card and do you have a license for DGDecNV?

What do you mean by "when i try to change of frames"?

yes I have an Nvidia card GeForce 9800 GT

dunno about the license dude , i have downloaded the tool of inet
sorry if u are the creator ;(
If i get to do work the tool, maybe I will buy the new version ^^

now about the error. I have added a button to change of frame summing 1 but when i change 6 frames more or less the error comes :(

i'm trying to do a tool to crop HD sources and the best way what I have thought is using AvisynthWrapper.cs because I dont know how DG DLLs API Works ;(

thank you for asking ,although I know that you will not help me :/

LoRd_MuldeR
30th June 2011, 22:41
dunno about the license dude , i have downloaded the tool of inet

You shouldn't download DGDecNV anywhere, but from the official web-site (http://neuron2.net/dgdecnv/dgdecnv.html). And on that web-site clearly indicates that you need to buy a license!

~ closed for rule #6 ~