Solved

asp.net c# execute .bat server side problem

Posted on 2016-09-15
6
56 Views
Last Modified: 2016-09-16
Hello I followed this tutorial to execute a .bat from server side:

http://codebetter.com/brendantompkins/2004/05/13/run-a-bat-file-from-asp-net/

And works perfect if I use in that .bat files commands like "del", "move", "copy" and all the internal commands of the command prompt. However we want to use the command "ffmpeg" to compress videos in that .bat files and of course "ffmpeg" is not internal command and the asp.net does nothing and ignores the .bat command if we use "frmpeg" command. We suppose this is because "ffmpeg" is not a internal command or something like that we don't know. Like I mentioned before all works perfect if I use internal commands but not when I use any other command that are not from the OS like this case the "ffmpeg". How can we be able to execute commands like "ffmpeg" from that .bat files and with asp.net c#? Or why happens this issue of the .bat files are accepted only with internal commands when you execute via the asp.net?

I hope someone can help.

Thank you
0
Comment
Question by:Alex E.
  • 3
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 250 total points
Comment Utility
It may be a pathing issue.
EG instead of running ffmpeg try giving it the full path:
(EG: C:\Program Files (X86)\ffmpeg)

It could also be  a security issue.
The application will run the bat file under the app pool it's running (EG: if the application's pool is running under network service, that will be the user that runs the bat file).

Try granting ffmpeg's security and all related files (dlls and such) to "everyone".  Lastly ensure there are write permissions for the new files.
0
 
LVL 74

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 250 total points
Comment Utility
Within the .bat file, are you using the start command to launch ffmpeg?
0
 

Author Comment

by:Alex E.
Comment Utility
this is the specific command:

ffmpeg -i "%%~fa" -acodec aac -ac 2 -strict experimental -ab 160k -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 "%%~dpna.mp4"

Open in new window


no start at the beginning.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
does it run in the directory if you just run it normal?  

What if you log into the server using the app pool identity?
0
 

Author Comment

by:Alex E.
Comment Utility
Yes if you run the .bat without the asp.net application runs perfect the .bat.

Exactly where and how can I log that? Because we went to event viewer and we don't see any special or is there any way to log this kind of things? how?
0
 

Author Closing Comment

by:Alex E.
Comment Utility
I made it work executing the line in this form:

start /ABOVENORMAL /I /D "C:\inetpub\wwwroot\act\" ffmpeg.exe -i "%%~fa" -acodec aac -ac 2 -strict experimental -ab 160k -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 "%%~dpna.mp4"
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now