ffmpeg to validate video format is genune and store error into string

614 Views Asked by At

Since there are hackers uploading malicious software's in name of video extensions(.mp4,webm..etc) in websites. I tried to validate videos uploaded from file upload in asp.net.This website helped me to find a way to do this operation using ffmpeg https://superuser.com/questions/100288/how-can-i-check-the-integrity-of-a-video-file-avi-mpeg-mp4 I tried to do this operation in asp.net and failed due to errors since my first time using ffmpeg.below is my code.I tried to save malicious software creates error in to a string.

       Process ffmpeg; 
       string video;
       string thumb="";
       video = Page.MapPath("") + "\\input\\error.mp4";
       ffmpeg = new Process();
       ffmpeg.StartInfo.Arguments = "-v error -i \"" + video + "\"-f null - 2> \"" + thumb + "\"";
       ffmpeg.StartInfo.FileName = Page.MapPath("ffmpeg//ffmpeg.exe");
       ffmpeg.Start(); // start !
       ffmpeg.StartInfo.CreateNoWindow = true;
       ffmpeg.WaitForExit();
       Label1.Text = thumb;

please also let me know if there is any other option other than ffmpeg

0

There are 0 best solutions below