如何从一个文件夹中的视频捕捉缩略图 [英] how to capture a thumbnail from a video in a folder

查看:91
本文介绍了如何从一个文件夹中的视频捕捉缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建类似YouTube网站,让上传视频后(这将是以.flv格式)到该项目的文件夹,缩略图必须从对应的视频捕捉。这里我设计我的网页使用asp.net和放大器; C#...

I am creating a website similar to youtube, so after uploading videos (that will be in .flv format) into a folder on the project, a thumbnail has to be captured from that corresponding video.. here i am designing my page using asp.net & c#...

我有从网上一些code,但其加工尺寸2-3Mb的只有视频....

I have got some code from the net, but its working only videos of size 2-3Mb....

任何一个可以帮助我的工作我的code为大型文件..

any one can help me to work my code for large sized files..

这是我的code ..

here's my code..

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using All4DotNet;

namespace LiveStreaming
{
public class Class1
{
    public static void GrabSingle_Thumb()
    {
        //Declare object of class MediaManagerPro
        MediaManagerPro oMediaManagerPro = new MediaManagerPro();

        //Get the rooth path
        string strRootPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath);

        //set the directory path info for ffmpeg file
        oMediaManagerPro.FFMPEG_Path = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");

        //Set source file info
        oMediaManagerPro.SourceFile_Path = strRootPath + "Videos";
        oMediaManagerPro.SourceFile_Name = "HelloWorld.flv";

        //set output file info
        oMediaManagerPro.OutputFile_Path = strRootPath + "Images";

        //Single Thumb - Properties available in free version
        oMediaManagerPro.Frame_Time = "5";
        oMediaManagerPro.Image_Format = "jpg";
        oMediaManagerPro.Image_Name = "Image_" + DateTime.Now.Ticks;

        ////Single Thumb - Properties available in full version
        //oMediaManagerPro.Width = 320;
        //oMediaManagerPro.Height = 240;

        //grab thumbnails
        MediaInfo oMediaInfo = oMediaManagerPro.Grab_Thumb();

        #region Print Output Information
        StringBuilder strOutputInfo = new StringBuilder();
        strOutputInfo.Append("Image Created = " + oMediaInfo.File_Name + "<br />");
        HttpContext.Current.Response.Write(strOutputInfo);
        #endregion
    }
  }
}

我从 http://www.helpprogrammers.com/csharpsample.aspx <此code / A>

I got this code from http://www.helpprogrammers.com/csharpsample.aspx

推荐答案

嗯,这似乎是一个选项,它的工作原理所有的时间,FFMPEG是,我们可以指望的解决方案。您也可以尝试FFMPEG的托管版本,也就是在 codePLEX 为好,其WIN-FFMPEG。这可能帮助。

Well this seems to be an option, which works all the time, FFMPEG is the solution that we can count on. You can also try the managed version of FFMPEG, that is on codeplex as well, its Win-FFMPEG. That might help.

这篇关于如何从一个文件夹中的视频捕捉缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆