Download ffmpeg.exe and paste it in ffmpeg folder
And
Write the code in
Codebehind
-----------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Diagnostics;
public partial class Videoframe : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Put the ffmpeg.exe into the source folder.
//Write the following code to grab thumbnail from the wmv video file into jpg file.
//Path for Video file
string InputFile = Server.MapPath ("~\\videos\\TestimonyDeafMinistry.mp4");
//Path for Image (jpg) file
string ThumbnailsPath = Server.MapPath("~\\videos\\testimage.jpg");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
//Select ffmpeg.exe
proc.StartInfo.FileName = Page.MapPath("~\\ffmpeg\\ffmpeg.exe");
//Pass the argument
// You can see the text in Red color below:
// First one is the frame and second is the size of the image
proc.StartInfo.Arguments = " -i \"" + InputFile + "\" -an -ss 00:00:03 -s 400*300 -vframes 1 -f image2 -vcodec mjpeg \"" + ThumbnailsPath + "\"";
//Start the Process
proc.Start();
}
}
And
Write the code in
Codebehind
-----------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Diagnostics;
public partial class Videoframe : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Put the ffmpeg.exe into the source folder.
//Write the following code to grab thumbnail from the wmv video file into jpg file.
//Path for Video file
string InputFile = Server.MapPath ("~\\videos\\TestimonyDeafMinistry.mp4");
//Path for Image (jpg) file
string ThumbnailsPath = Server.MapPath("~\\videos\\testimage.jpg");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
//Select ffmpeg.exe
proc.StartInfo.FileName = Page.MapPath("~\\ffmpeg\\ffmpeg.exe");
//Pass the argument
// You can see the text in Red color below:
// First one is the frame and second is the size of the image
proc.StartInfo.Arguments = " -i \"" + InputFile + "\" -an -ss 00:00:03 -s 400*300 -vframes 1 -f image2 -vcodec mjpeg \"" + ThumbnailsPath + "\"";
//Start the Process
proc.Start();
}
}
No comments:
Post a Comment