Click here to Skip to main content
15,861,168 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am trying to use ffmpeg to convert a video to mpg on my ASP.NET site (C#)

My code is as follows:

string videoname = name of video uploaded on site in folder Videos without extenstion;
            string videoext = extension of video //or example .mpg)
            
           // convert video to mpg format
           string inputfile = Page.MapPath("Videos\\"+videoname+videoext);
           string outputfile = Page.MapPath("") + "\\VideoMpg\\"+ videoname +".mpg";//VideoMpg is the folder in which the converted video is to be stored
           string fileargs = "-i " + inputfile + " -ar 22050 " + outputfile;
           Process proc = new Process();
           proc.StartInfo.FileName = Page.MapPath("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);
           }

I have placed ffmpeg.exe file in a folder named ffmpeg. this is the only file in that folder

This works fine in visual studio 2013 and an mpg video is created and stored but when I upload it to server, I do not get the converted video.
I have ASP.NET 4.0 both on my local machine and on the site.

I have not been able to find why it does not work on server when it works on Visual studio

Kindly help me to make this project work on server.

Thanks
Posted
Comments
ZurdoDev 9-Oct-14 14:15pm    
You are starting the process. If you think about it, where does your code run? On the server and by default under a restricted account.

It sounds like it may be a permissions issue.
[no name] 9-Oct-14 14:15pm    
You probably do not have permission to run executables on the server.
Member 10235977 9-Oct-14 16:12pm    
I have contacted my server. their reply is that I server is working fine and I have full powers to install any software. I wonder if ffmpeg requires installation of any software on remote computer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900