TS流批量下载工具
工具目錄下有3個文件
ffmpeg.exe: 主要用來 處理TS文件轉為PM4文件用到,可以自行到相關網站下載 http://ffmpeg.org/
OnlineFilm.exe ?主要執行程序
FilesDownLoad.dll 下載模塊
?
新建
? ? ?新建 TS文件的索引文件,*.M3u8,怎么獲取,參照“Ts文件說明”。
M3U8文件如果是本地的文件,需要填寫 通用地址。
修改
刪除
? ? 直接刪除這條記錄,可以多選刪除
統計
??
? ?統計已經下載完成的記錄數
下載
? ?彈出下載的窗口,進行下載。每個資源文件都需要打開該界面進行下載。
打開文件夾
? 打開該下載的文件夾
讀取M3u8
?批量讀取文件 ?
讀取的批量文件為 DetailList.txt,并放置到 和工具一個目錄下。
格式為:名稱|地址(URL),一行一條記錄。
美女?| https://www.abc/xxx/index.m3u8
直播 | https://www.abc/yyy/index.m3u8
合并TS文件
? 如果多個TS文件,沒有自動合并,可以使用該功能進行合并操作
?
? TS文件轉換為MP4文件,需要用到 ffmpeg.exe
?
?
1、TS 文件合并private void Merge(){CmdHelper c = new CmdHelper();//>copy/b f:\ts\11\*.ts f:\ts\11\temp\new.tsstring newpath = _entity.RootFilePath + "\\" + _entity.FileName + "\\";string newpath1 = _entity.RootFilePath + "\\" + _entity.FileName + "\\tmp\\";if (!Directory.Exists(newpath1)) //判斷是否存在{Directory.CreateDirectory(newpath1); //創建新路徑 }if (File.Exists(newpath1 + _entity.FileName + ".ts")){File.Delete(newpath1 + _entity.FileName + ".ts");}string cmd = @"copy/b " + newpath + "*.ts " + newpath1 + _entity.FileName + ".ts";string s = c.RunCmd(cmd);// MessageBox.Show("合并完成");}/// <summary>/// 執行CMD語句/// </summary>/// <param name="cmd">要執行的CMD命令</param>public string RunCmd(string cmd){proc.StartInfo.CreateNoWindow = true;proc.StartInfo.FileName = "cmd.exe";proc.StartInfo.UseShellExecute = false;proc.StartInfo.RedirectStandardError = true;proc.StartInfo.RedirectStandardInput = true;proc.StartInfo.RedirectStandardOutput = true;proc.Start();proc.StandardInput.WriteLine(cmd);proc.StandardInput.WriteLine("exit");string outStr = proc.StandardOutput.ReadToEnd();proc.Close();return outStr;}2、TS轉MP4string fullFileName = System.IO.Path.Combine(Application.StartupPath, "ffmpeg.exe"); /// <summary>/// TS -->Mp4/// </summary>private void TsToMP4(){// ffmpeg -y -i F:\Ts\11\tmp\11.ts -c:v libx264 -c:a copy -bsf:a aac_adtstoasc F:\Ts\11\tmp\11.mp4 //ffmpeg -y -i in.ts -c:v libx264 -c:a copy -bsf:a aac_adtstoasc output.mp4//ffmpeg -y -i F:\Ts\11\tmp\11.ts -c:v libx264 -c:a copy -bsf:a aac_adtstoasc F:\Ts\11\tmp\11.mp4 if (!File.Exists(_path)){return;} string Mp4File = System.IO.Path.GetDirectoryName(_path) + "\\" +System.IO.Path.GetFileNameWithoutExtension(_path) + ".mp4"; string para = string.Format("-y -i {0} -c:v libx264 -c:a copy -bsf:a aac_adtstoasc {1}", _path, Mp4File);CmdHelper.RunMyProcess(para, fullFileName); }/// <summary>/// /// </summary>/// <param name="Parameters">執行參數</param>/// <param name="FFmpegPath">ffmpeg.exe 路徑</param>public static void RunMyProcess(string Parameters, string FFmpegPath){var p = new Process();p.StartInfo.FileName = FFmpegPath;p.StartInfo.Arguments = Parameters;//是否使用操作系統shell啟動p.StartInfo.UseShellExecute = false;//不顯示程序窗口p.StartInfo.CreateNoWindow = true;p.Start(); p.WaitForExit();p.Close();}?
?
工具下載地址:https://download.csdn.net/download/yunfan555/10812630
?
?
歡迎交流。
?
?
?
總結
- 上一篇: 《刺杀骑士团长》读后感
- 下一篇: HC-05蓝牙模块