解决方案 »
- CSDN 鼠标移入头像效果
- ajax 图片上传
- ASP。NET动态生成表格及数据填充WORD
- .net中截取字符串长度的代码如何重复使用,写成CS文件在ASPX页中如何调用
- .net设置断点
- 怎样设置背景页啊。。。。。。。。。。。。。。
- 一个新手的简单问题:怎么生成一个最简单的TreeView ?
- 在VS2003移动开发中怎样将仿真设备(pocket pc 2002)插入底座?
- 怎样实现类似DropDownList的Items属性?我写的设置不了属性的值(附代码)
- 那位大哥用JMAIL发送邮件和收取附件成功了的,把代码贴出来把!救命啊
- 我的这个javascript怎么回事?帮个忙谢谢了
- 访问Application全局变量出现需要调试的异常
您好,我已经是用了这段代码,可是PlayFiles里面,和ImgFiles里面没有数据。请问这是什么原因呢?
public static bool changeVideoType(string fileName, string playFile, string imgFile)
{
//获取视频转换工具的路径
string ffmpeg= System.Web.HttpContext.Current.Server.MapPath("../") + ffmpegtool;
//获取需要转换的视频路径
string Name = System.Web.HttpContext.Current.Server.MapPath("../") + upFile + "/" + fileName;
if ((!System.IO.File.Exists(ffmpeg)) || (!System.IO.File.Exists(Name)))
{
return false;
}
//获取视频转换后需要保存的路径
string flv_file = playFile;
//创建Process对象
Process pss = new Process();
//不显示窗口
pss.StartInfo.CreateNoWindow = false;
//设置启动程序的路径
pss.StartInfo.FileName = ffmpeg;
//设置执行的参数
pss.StartInfo.Arguments = " -i " + Name + " -ab 128 -ar 22050 -qscale 6 -r 29.97 -s " + widthOfFile + "x" + heightOfFile + " " + flv_file;
try
{
//启动转换工具
pss.Start();
while (!pss.HasExited)
{
continue;
}
//截取视频的图片
catchImg(Name, imgFile);
System.Threading.Thread.Sleep(4000);
if (!File.Exists(imgFile))
{
File.Copy(System.Web.HttpContext.Current.Server.MapPath("../") + "imgHead\\default.gif", imgFile);
} return true;
}
catch
{
return false;
}
}
// 显示视频
public static string GetFlashText(string url)
{
url = "player.swf?fileName=" + url;
string str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='452' height='360' id='index' name='index'><param name='allowScriptAccess' value='always' /><param name='movie' value='" +
url + "'><embed src='" +
url + "' id='index1' name='index1' type='application/x-shockwave-flash' swLiveConnect=true allowScriptAccess='always' width='452' height='360'></embed></object>";
return str;
}
//截取字符串CodeGo.net/
public static string interceptStr(string str, int len)
{
if (str.Length > len)
{
str = str.Substring(0,len)+ "...";
}
return str;
}
public static string filtrateHtml(string str)
{
str = str.Trim();
str = str.Replace("'", """);
str = str.Replace("<", "<");
str = str.Replace(">", ">");
str = str.Replace(" ", " ");
str = str.Replace("\n", "<br>");
return str;
}
public static string resumeHtml(string str)
{
str = str.Trim();
str = str.Replace(""", "'");
str = str.Replace("<", "<");
str = str.Replace(">", ">");
str = str.Replace(" ", " ");
str = str.Replace("<br>", "\n");
return str;
}
public static void catchImg(string fileName,string imgFile)
{
//获取截图工具路径
string ffmpeg = System.Web.HttpContext.Current.Server.MapPath("../") + ffmpegtool;
//获取截图后保存的路径
string flv_img = imgFile;
//获取截取图片的大小
string FlvImgSize = sizeOfImg;
Process pss = new Process();
//设置启动程序的路径
pss.StartInfo.FileName = ffmpeg;
pss.StartInfo.Arguments = " -i " + fileName + " -y -f image2 -ss 2 -vframes 1 -s " + FlvImgSize + " " + flv_img;
//启动进程
pss.Start();
}