User655436493 posted
Hi, I am trying to convert the avi file to flv but its not converting, Its creating the .flv file in the folder but its corrupted I guess, its not opening that file.
Is there anything wrong in my code?
Thanks,
.aspx:
<tr>
<td>
File :
</td>
<td>
<asp:FileUpload ID="upload_imgstatic" runat="server" />only jpg or jpeg
</td>
</tr>
<tr>
<td colspan="2">
<br />
<asp:Button ID="Button1" runat="server" Text="Save" OnClick="save_CommandStatic" /><hr />
</td>
</tr>
.cs:
protected void save_CommandVideopersonal(object sender, EventArgs e)
{
// tb_artist tb_name tb_album tb_genre FileUpload1
if (upload_videopersonal.HasFile)
{
string ext = Path.GetExtension(upload_videopersonal.FileName).ToLower();
//if (ext == ".flv")
{
string defext = ".flv";
string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff");
string filepath = "FuneralPersonalVideos/" + filename + ext;
upload_videopersonal.SaveAs(Server.MapPath("~/" + filepath));
//filename = filepath;
string video = Server.MapPath("~/" + "FuneralPersonalVideos/" + filename + ext); //@"D:\Projects\testapp\Uploads\videowmv.wmv";
string mpg = Server.MapPath("~/" + "FuneralPersonalVideos/" + filename + defext); //@"D:\Projects\testapp\Uploads\videoflv.flv";
string cmd = " -i " + "" + video + " " + " " + "" + mpg + "" + "";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = Server.MapPath("~/" + "ffmpeg/ffmpeg.exe");//@"D:\Projects\Gastro\bin\ffmpeg";
proc.StartInfo.Arguments = cmd;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
//upload_videopersonal.SaveAs(mpg);
int eid = Convert.ToInt32(Session["AdminEventID"]);
//CommonFunctions.CreateThumbnail(filename, this.Page);
//db.InsertFuneralPersonalVideo(eid, tb_titlevideopersonal.Text, filename);
CommonFunctions.JavaScriptAlertMessage("Your Video has been uploaded.", this.Page);
tb_titlevideopersonal.Text = "";
}
//else
// CommonFunctions.JavaScriptAlertMessage("Only flv files allowed!", this.Page);
grid_videopersonal.DataBind();
}
}