FORUMS: list search recent posts

ffmpeg is not converting

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>

ola leke
ffmpeg is not converting
on Jun 12, 2011 at 12:36:31 pm

I have the latest version of ffmpeg in my website project. I am using asp net c# and visual web developer express 2010 for the website building.

I don't know what I am coding wrong if at all. otherwise it must be permission issue. and in this regard, I have tried all I can giving permission to entire project folder but still no conversion.

This same code works fine and converts last two months where as at that time I was using windows vista. but now I upgraded to Windows 7.

please someone, an expert, who knows about these issues should help. I am a little girl learning, doing and writing programs.

here are my code:


#region DoingUploadingNewVideos
public static void DoingUploadingNewVideos(DateTime UploadedDate, TextBox BoxVideoname, Label UploadStatus, FileUpload Video, Label ImgStatus, string US, Label ExLabel)
{
try
{
Byte[] bytes = Video.FileBytes;
System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);
Guid Id = GetRegUserId(US);
var extension = System.IO.Path.GetExtension(Video.FileName);
if (extension.ToLower() == ".wm" || extension.ToLower() == ".wmv" || extension.ToLower() == ".asf" || extension.ToLower() == ".m2ts" || extension.ToLower() == ".m2t" || extension.ToLower() == ".mov" || extension.ToLower() == ".qt" || extension.ToLower() == ".avi" || extension.ToLower() == ".wtv" || extension.ToLower() == ".dvr-ms" || extension.ToLower() == ".mp4" || extension.ToLower() == ".m4v" || extension.ToLower() == ".mpeg" || extension.ToLower() == ".mpg" || extension.ToLower() == ".mpe" || extension.ToLower() == ".m1v" || extension.ToLower() == ".mp2" || extension.ToLower() == ".mpv2" || extension.ToLower() == ".mod" || extension.ToLower() == ".swf" || extension.ToLower() == ".flv")
{
int VideoSize = Video.PostedFile.ContentLength;
if (VideoSize < 50001000)
{
#region Process

string postedfilename, SavePath, Filenamewithpath;

#region swf format

postedfilename = Video.PostedFile.FileName;
string pth = AppDomain.CurrentDomain.BaseDirectory;
SavePath = pth + "Folders" + "\UserVideo\" + US + "\";
DirectoryInfo di = new DirectoryInfo("" + SavePath + "");
if (!(di.Exists))
{
di.Create();
}
string NewFName = postedfilename;
NewFName = NewFName.Substring(NewFName.LastIndexOf("\") + 1, NewFName.Length - NewFName.LastIndexOf(".")) + "." + NewFName.Substring(NewFName.LastIndexOf(".") + 1);
Filenamewithpath = SavePath + NewFName;

//Save The file
Video.PostedFile.SaveAs(Filenamewithpath);

//Start Converting
string inputfile, outputfile, filargs;
string withoutext;

//Get the file name without Extension
withoutext = Path.GetFileNameWithoutExtension(Filenamewithpath);

//Input file path of uploaded image
inputfile = SavePath + NewFName;

//output file format in swf
string swfpath = SavePath + "FLV\";
outputfile = swfpath + withoutext + ".flv";

DirectoryInfo diswfpath = new DirectoryInfo("" + swfpath + "");
if (!(diswfpath.Exists))
{
diswfpath.Create();
}
string spath;

//file arguments for FFMPEG
filargs = "-i" + "" + inputfile + "" + "-ar 22050" + "" + outputfile + "";
spath = AppDomain.CurrentDomain.BaseDirectory;
Process proc;
proc = new Process();
proc.StartInfo.FileName = spath + "\ffmpeg\ffmpeg.exe";
proc.StartInfo.Arguments = filargs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
try
{

proc.Start();

}
catch (Exception ex)
{
ExLabel.Text = ex.Message;
}
proc.WaitForExit();
proc.Close();


#endregion

#region thumbnails
//Create Thumbs

string thumbpath, thumbname;
string thumbargs;
thumbpath = SavePath + "Thumb\";
DirectoryInfo dithumbpath = new DirectoryInfo("" + thumbpath + "");
if (!(dithumbpath.Exists))
{
dithumbpath.Create();
}

thumbname = thumbpath + withoutext + "1" + ".flv";

thumbargs = "-i" + inputfile + "-vframes 1 -ss 00:00:03 -s 150x150" + thumbname;

Process thumbproc = new Process();
thumbproc = new Process();
thumbproc.StartInfo.FileName = spath + "\ffmpeg\ffmpeg.exe";
thumbproc.StartInfo.Arguments = thumbargs;
thumbproc.StartInfo.UseShellExecute = false;
thumbproc.StartInfo.CreateNoWindow = true;
thumbproc.StartInfo.RedirectStandardOutput = false;
try
{
thumbproc.Start();
}
catch (Exception ex)
{
ExLabel.Text = ex.Message;
}
thumbproc.WaitForExit();
thumbproc.Close();



#endregion

#region img
//Create imgjpegs

string imgjpegpath, imgjpegname;
string imgjpegargs;
string imgjpegre;
imgjpegpath = SavePath + "Imgjpg\";
DirectoryInfo diimgjpegpath = new DirectoryInfo("" + imgjpegpath + "");
if (!(diimgjpegpath.Exists))
{
diimgjpegpath.Create();
}

imgjpegname = imgjpegpath + withoutext + "%d" + ".jpg";

imgjpegargs = "-i" + inputfile + "-vframes 1 -ss 00:00:03 -s 150x150" + imgjpegname;

Process imgjpegproc = new Process();
imgjpegproc = new Process();
imgjpegproc.StartInfo.FileName = spath + "\ffmpeg\ffmpeg.exe";
imgjpegproc.StartInfo.Arguments = imgjpegargs;
imgjpegproc.StartInfo.UseShellExecute = false;
imgjpegproc.StartInfo.CreateNoWindow = true;
imgjpegproc.StartInfo.RedirectStandardOutput = false;
try
{

imgjpegproc.Start();

}
catch (Exception ex)
{
ExLabel.Text = ex.Message;
}
imgjpegproc.WaitForExit();
imgjpegproc.Close();



#endregion

File.Delete(inputfile);

#endregion
}
else
{
UploadStatus.Text = Resources.Lang.TooBigVideoSize;
UploadStatus.ForeColor = Color.Red;
}
}
else
{
UploadStatus.Text = Resources.Lang.NotOurValidVideoFormat;
UploadStatus.ForeColor = Color.Red;
}
}
catch (Exception ex)
{
ExLabel.Text = ex.Message;
}
}
#endregion


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]