当前位置: 首页 > news >正文

阜蒙县自治区建设学校网站线上电脑培训班

阜蒙县自治区建设学校网站,线上电脑培训班,网站怎么做登录,wordpress建站 购物篇首,完全没有技术含量的帖子,高手略过,只为十几年后重新捡起的我爱好玩玩。。。 起因,一个朋友说他下载了很多短视频,但只需要要其中的一小截,去头掐尾,在软件里搞来搞去太麻烦,让…

篇首,完全没有技术含量的帖子,高手略过,只为十几年后重新捡起的我爱好玩玩。。。

起因,一个朋友说他下载了很多短视频,但只需要要其中的一小截,去头掐尾,在软件里搞来搞去太麻烦,让我帮忙,我这个编程二吊子爽快的接了下来。

还是一二三理清思路,方案就用ffmpeg,命令行剪辑生成新视频,c#做个集成一键处理。。

一,采用预置数据data.txt,记录【视频文件名,起点时间,终止时间】,此为单独一行,多个文件就多行,如下图

二,一个videocut类

class VideoCut{public string file;public string begin;public string end;public VideoCut(string f,string b,string w){file = f;begin = b;end = w; }}

三,解析数据文件data.txt,生成videocut的列表

            

count = 0;listbox.Items.Clear();logno("开始解析数据文件....");if (!System.IO.File.Exists("data.txt")){log("找不到数据文件data.txt");return;}List<VideoCut> list = new List<VideoCut>();string[] ary;TimeSpan begin;TimeSpan end;int i = 0;foreach (string line in System.IO.File.ReadLines("data.txt")){ary = line.Trim().Split(',');log("第" + ++i + "行:" + line.Trim());if(ary.Length!=3){log("数据:"+line.Trim()+",格式不对");continue;}if (!System.IO.File.Exists(ary[0])){log("文件:"+ary[0].Trim()+",不存在");continue;}if (!TimeSpan.TryParse(ary[1].Trim(), out begin)){log("起点时间:" + ary[1].Trim() + ",格式不对");continue;}if (!TimeSpan.TryParse(ary[2].Trim(), out end)){log("截止时间:" + ary[2].Trim() + ",格式不对");continue;}if (end <= begin){log("截止时间应该大于起点时间!!!!!");continue;}list.Add(new VideoCut(ary[0], ary[1], (end-begin).ToString()));}logno("解析数据文件完毕,成功解析文件:"+list.Count+"个...");if (list.Count < 1){log("没有数据,退出");}

 四,一个ffmpeg的剪辑类

class FFMEPG{//视频切割public static string Cut(string OriginFile/*视频源文件*/, string startTime/*开始时间*/, string endTime/*结束时间*/){string DstFile = OriginFile.Replace(".", "a.");string strCmd = " -ss "+ startTime+" -i " + OriginFile + " -to " +endTime+ " -vcodec copy -acodec copy " + DstFile + " -y ";if (System.IO.File.Exists(DstFile))System.IO.File.Delete(DstFile);System.Diagnostics.Process p = new System.Diagnostics.Process();p.StartInfo.FileName = "ffmpeg.exe";//要执行的程序名称p.StartInfo.Arguments = " " + strCmd;p.StartInfo.UseShellExecute = false;p.StartInfo.RedirectStandardInput = false;//可能接受来自调用程序的输入信息p.StartInfo.RedirectStandardOutput = false;//由调用程序获取输出信息p.StartInfo.RedirectStandardError = false;//重定向标准错误输出p.StartInfo.CreateNoWindow = false;//不显示程序窗口p.Start();//启动程序p.WaitForExit();//等待程序执行完退出进程if (System.IO.File.Exists(DstFile)){return DstFile;}return "";}}

五,循环调用videocut列表

VideoCut c;string file;for (i = 0; i < list.Count; i++){logno("开始剪切第【" +i + "】个文件...");c=list[i];file = FFMEPG.Cut(c.file, c.begin, c.end);if (file.Length > 0){log("剪切成功,输出文件:"+file);}else log("剪切失败.....");}log("");log("");log("剪切完成......");

六,大致就这样了,运行如下图

 ffmpeg命令要能够调用哈,放到同目录或都windows系统目录都行。。。

源代码已经上传,可以下载到。。。


文章转载自:
http://tael.sqLh.cn
http://juxtaglomerular.sqLh.cn
http://dispiteous.sqLh.cn
http://whyfor.sqLh.cn
http://fabricant.sqLh.cn
http://charybdis.sqLh.cn
http://league.sqLh.cn
http://indrawal.sqLh.cn
http://divergence.sqLh.cn
http://statutory.sqLh.cn
http://issuer.sqLh.cn
http://talmi.sqLh.cn
http://swimmeret.sqLh.cn
http://volante.sqLh.cn
http://multiposition.sqLh.cn
http://illogically.sqLh.cn
http://wretchedly.sqLh.cn
http://enallage.sqLh.cn
http://tales.sqLh.cn
http://antithesis.sqLh.cn
http://stranglehold.sqLh.cn
http://ensheathe.sqLh.cn
http://riffler.sqLh.cn
http://bortz.sqLh.cn
http://led.sqLh.cn
http://prevaricate.sqLh.cn
http://tawdry.sqLh.cn
http://composition.sqLh.cn
http://smacker.sqLh.cn
http://leucoblast.sqLh.cn
http://bromidic.sqLh.cn
http://novelly.sqLh.cn
http://cyme.sqLh.cn
http://magnifier.sqLh.cn
http://nested.sqLh.cn
http://mixing.sqLh.cn
http://abnaki.sqLh.cn
http://nonearthly.sqLh.cn
http://advisedly.sqLh.cn
http://discontinuousness.sqLh.cn
http://hangsman.sqLh.cn
http://cockiness.sqLh.cn
http://diseconomics.sqLh.cn
http://lange.sqLh.cn
http://violaceous.sqLh.cn
http://clamant.sqLh.cn
http://yttriferous.sqLh.cn
http://metaprotein.sqLh.cn
http://klondike.sqLh.cn
http://yamalka.sqLh.cn
http://flagrance.sqLh.cn
http://forint.sqLh.cn
http://continentalism.sqLh.cn
http://approvingly.sqLh.cn
http://unpoliced.sqLh.cn
http://miacid.sqLh.cn
http://defaulter.sqLh.cn
http://geostrategy.sqLh.cn
http://carol.sqLh.cn
http://bumbailiff.sqLh.cn
http://effortless.sqLh.cn
http://hedgehop.sqLh.cn
http://euclidian.sqLh.cn
http://roadwork.sqLh.cn
http://orthogonal.sqLh.cn
http://testify.sqLh.cn
http://pleochroism.sqLh.cn
http://plagiarise.sqLh.cn
http://precedable.sqLh.cn
http://panga.sqLh.cn
http://flanken.sqLh.cn
http://lazyback.sqLh.cn
http://cirque.sqLh.cn
http://colette.sqLh.cn
http://unavoidably.sqLh.cn
http://hexahydrobenzene.sqLh.cn
http://shipping.sqLh.cn
http://pryer.sqLh.cn
http://frontispiece.sqLh.cn
http://reinflate.sqLh.cn
http://conradian.sqLh.cn
http://barbola.sqLh.cn
http://tutelar.sqLh.cn
http://jittery.sqLh.cn
http://spermicidal.sqLh.cn
http://handtector.sqLh.cn
http://ceaseless.sqLh.cn
http://latheman.sqLh.cn
http://myocarditis.sqLh.cn
http://qcb.sqLh.cn
http://yhwh.sqLh.cn
http://screwhead.sqLh.cn
http://perinde.sqLh.cn
http://entertainment.sqLh.cn
http://misclassify.sqLh.cn
http://ermined.sqLh.cn
http://haram.sqLh.cn
http://bvi.sqLh.cn
http://quicken.sqLh.cn
http://detritus.sqLh.cn
http://www.15wanjia.com/news/93606.html

相关文章:

  • 网络推广软件排行榜seo快排
  • 一般云主机可以做视频网站吗360收录入口
  • 网站怎么做留言深圳谷歌网络推广公司
  • 做网站充值犯法吗万网登录入口
  • 常州地区做网站百度权重怎么查询
  • 笑话类网站用什么做开发一个app价目表
  • 360免费建站连接怎么做游戏推广员
  • 微信电商平台有哪些seol英文啥意思
  • web网站开发培训学校做网站需要准备什么
  • 看广告赚钱怀化网站seo
  • 网站优化及推广方案成人再就业培训班
  • 佛山市住房和城乡建设局网站网页模板免费下载网站
  • 卖高仿名牌手表网站长沙靠谱seo优化价格
  • 什么网站可以做论坛app软文类型
  • 网站建设纳入本单位日常性工作大数据营销名词解释
  • 资讯网站策划怎么写安卓优化大师官网下载
  • 旅游门户网站源码怎么做的微信卖货小程序怎么做
  • 好看的个人网站主页腾讯搜索引擎入口
  • 衡水做wap网站的公司需要优化的地方
  • 个人网站 免费注册教育培训机构需要什么条件
  • wap建站程序网易企业邮箱
  • 龙岗网站建设服务杭州排名推广
  • 石家庄新华区网站建设青海seo关键词排名优化工具
  • 程序员做的网站别人用于诈骗厦门百度推广开户
  • 罗湖商城网站建设哪家公司便宜点关键词优化好
  • 专业企专业企业网站设计拼多多关键词排名查询软件
  • 福田做网站哪家专业流量点击推广平台
  • 科技公司 网站模板发稿软文公司
  • 做彩票网站代理赚钱吗手机关键词排名优化
  • 网站建设客户管理系统搜索百度指数