日期:2014-05-18  浏览次数:20846 次

关于文件写入avs脚本的问题
我现在需要在程序里面写入一个avs脚本,以下这段代码单独调试可以正常运行,但是放在我的程序里面不执行写入操作.我可以保证路径输入是正确无误的,程序运行到这段代码的时候也没有报错,好像直接跳过了try里面的代码一样.非常奇怪,希望高手指点! 另外avs脚本不知道可不可以这样写入,如果错了,请告诉一下到底该怎么写,谢谢

  public void AddWaterMarkInAVS(string AVSFilePath, string AVSFileName, string VideoFilePath, string VideoFileName, string LogoFileName, int x, int y)
  {
  string AVS = AVSFilePath + AVSFileName;
  string Video = VideoFilePath + VideoFileName;
  string Logo = AVSFilePath + LogoFileName;

  try
  {
  StreamWriter sw = new StreamWriter(AVS, false, Encoding.Unicode);
  sw.WriteLine("video = DirectShowSource(\"{0}\",15).converttorgb32", Video);
  sw.WriteLine("logo=ImagerReader(\"{0}\").converttorgb24.flipvertical()", Logo);
  sw.WriteLine("videologo=logo.converttorgb32.colorkeymask($ffffff,100)");
  sw.WriteLine("Layer(video,videologo,\"add\",255,{0},{1})", x, y);
  sw.Flush();
  sw.Close();

  }
  catch { }
  }

------解决方案--------------------
用ASCII编码就可以了.