发布时间:2025-12-09 14:09:03 浏览次数:4
工具目录下有3个文件
ffmpeg.exe: 主要用来 处理TS文件转为PM4文件用到,可以自行到相关网站下载 http://ffmpeg.org/
OnlineFilm.exe 主要执行程序
FilesDownLoad.dll 下载模块
删除
直接删除这条记录,可以多选删除
统计
统计已经下载完成的记录数
下载
弹出下载的窗口,进行下载。每个资源文件都需要打开该界面进行下载。
打开该下载的文件夹
读取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\*.ts f:\ts\temp\new.ts string 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转MP4 string fullFileName = System.IO.Path.Combine(Application.StartupPath, "ffmpeg.exe"); /// <summary> /// TS -->Mp4 /// </summary> private void TsToMP4() { // ffmpeg -y -i F:\Ts\tmp.ts -c:v libx264 -c:a copy -bsf:a aac_adtstoasc F:\Ts\tmp.mp4 //ffmpeg -y -i in.ts -c:v libx264 -c:a copy -bsf:a aac_adtstoasc output.mp4 //ffmpeg -y -i F:\Ts\tmp.ts -c:v libx264 -c:a copy -bsf:a aac_adtstoasc F:\Ts\tmp.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
欢迎交流。