首页  ·  知识 ·  编程语言
视频上传截图(flv)
网友  其它 |   .NET  编辑:德仔   图片来源:网络
blog_text cnt //参数都为上传的视频路径及文件名,要保存的文件路径及文件名br /&

//参数都为上传的视频路径及文件名,要保存的文件路径及文件名
    public string MChangeFilePhy(string vFileName, string playFile)
    {
        string tool = Server.MapPath("~/Js/mencoder.exe");

        System.Diagnostics.ProcessStartInfo FilestartInfo = new System.Diagnostics.ProcessStartInfo(tool);

        FilestartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

        FilestartInfo.Arguments = " " + vFileName + " -o " + playFile + " -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=5000:mbd=2:mv0:trell:v4mv:cbp:last_pred=1:dia=4:cmp=6:vb_strategy=1 -vf scale=" + "400" + ":" + "350" + " -ofps 12 -srate 22050";
        try
        {
            System.Diagnostics.Process.Start(FilestartInfo);
        }
        catch
        {
            return "";
        }
        //
        return "";
    }

    public string CatchImg(string fileName, string imgFile)
    {
        //
        string ffmpeg = Server.MapPath("~/Js/ffmpeg.exe");
        //
        string flv_img = imgFile;
        //
        string FlvImgSize = "240x180";
        //
        System.Diagnostics.ProcessStartInfo ImgstartInfo = new System.Diagnostics.ProcessStartInfo(ffmpeg);
        ImgstartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        //
        ImgstartInfo.Arguments = "   -i   " + fileName + " -y -f image2   -ss 2 -vframes 1 -s   " + FlvImgSize + "   " + flv_img;
        try
        {
            System.Diagnostics.Process.Start(ImgstartInfo);
        }
        catch
        {
            return "";
        }
        //
        if (System.IO.File.Exists(flv_img))
        {
            return flv_img;
        }

        return "";
    }


 
本文作者:网友 来源:其它 |
CIO之家 www.ciozj.com 微信公众号:imciow
   
免责声明:本站转载此文章旨在分享信息,不代表对其内容的完全认同。文章来源已尽可能注明,若涉及版权问题,请及时与我们联系,我们将积极配合处理。同时,我们无法对文章内容的真实性、准确性及完整性进行完全保证,对于因文章内容而产生的任何后果,本账号不承担法律责任。转载仅出于传播目的,读者应自行对内容进行核实与判断。请谨慎参考文章信息,一切责任由读者自行承担。
延伸阅读