I am trying to upload video files in an ASP.NET website using C#.
I have downloaded ffmpeg library files from www.afterdawn.com/software/audio_video/convert_video/ffmpeg.cfm"
and pasted it in a folder ffmpeg.
my ffmpeg has a subfolder also named ffmpeg contaiing files ffmpeg.exe, ffplay.exe and ffprobe.exe. (the files that are in bin folder of downloaded ffmpeg files. Thus, ffmpeg.exe file is at location /ffmpeg/ffmpeg/ffmpeg.exe.
In aspx file I have a fileupload, a button to upload. The code is.aspx file is:
<div style="removed:relative; removed50px; width:700px;">
<br />
<br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Upload" />
</div>
The code in my code behind file is
using System;
using System.IO;
using System.Diagnostics;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string inputfilename = FileUpload1.FileName;
string inputfile = "C://"+inputfilename;
string outputfile = "/Videos/" + FileUpload1.FileName;
string fileargs = "-i" + inputfile + "-ar 22050" + outputfile;
Process proc;
proc = new Process();
proc.StartInfo.FileName = Server.MapPath("~" + outputfile) + "\\ffmpeg\\ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = fileargs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardInput = false;
try
{
proc.Start();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
}
When i run this application and try to upload a video, I get the exception error message "The system cannot find the file specified."
I need help to find whether i am misisng any using directive or assembly reference or what mistake i am making in use of ffmpeg code.
Many thanks for help.