合并ts文件
合并ts文件
合并ts文件
文件在手机中的存储:
├── fe2cd5a64fe78a69f90a7c0a2b08a240e1444082.ts
├── ff5b590b44e676dc0a72d127fd165adaa0a478ec.ts
├── ff7085e695211f5e0b8cd239d51ad7870889c14b.ts
├── ....
├── ffec91db3441fd42adab27d0dbe26f424fc23a1d.ts
├── index.m3u8
├── index.m3u8.play
├── task.info
1) 根据猎豹浏览器中的download.db,使用sqlite3打开文件,查看对应文件在手机浏览器中的真实路径.
2) 通过手机插上U盘/移动硬盘,将文件拷贝到电脑
3) 根据index.m3u8.play中的ts片段文件,生成一个总的ts文件.
可以使用C/OC/python等,读取index.m3u8.play文件,生成类似下面的shell语句,即可合并为一个ts文件.
windows:
copy /b “1.ts”+“2.ts”+…+”n.ts” /y “combine.ts”
mac:
cat 1.ts 2.ts > combine.ts
相关程序代码:
//读文件
NSString *fullFilePath = @"/xxx/index.m3u8.play";
NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:fullFilePath ];
NSData *data3 = [handle readDataToEndOfFile];
NSString *temp = [[NSString alloc]initWithData:data3 encoding:NSUTF8StringEncoding];
NSArray *tempArray = [temp componentsSeparatedByString:@"\n"];
NSMutableArray *fileMArray = [NSMutableArray array];
for (NSInteger index = 0 ; index < tempArray.count; index++) {
NSString *fileContentLine = tempArray[index];
if ([fileContentLine hasSuffix:@".ts"]) {
[fileMArray addObject:fileContentLine];
}
}
NSString *fileNames = [fileMArray componentsJoinedByString:@" "];
//写入文件
NSString *toPath = @"/yyy/combineTSFile.sh";
NSFileHandle *handle2 = [NSFileHandle fileHandleForWritingAtPath:toPath];
NSLog(@"%s [LINE:%d] fileNames=%@", __func__, __LINE__,fileNames);
NSData *data = [fileNames dataUsingEncoding:NSUTF8StringEncoding];
[handle2 writeData:data];
[handle2 synchronizeFile];
[handle2 closeFile];
4) 将ts文件转换为mp4文件
ffmpeg -i combine.ts -acodec copy -vcodec copy -bsf aac_adtstoasc output.mp4
合并ts文件的更多相关文章
- python爬虫:抓取下载视频文件,合并ts文件为完整视频
1.获取m3u8文件 2.代码 """@author :Eric-chen@contact :sygcrjgx@163.com@time :2019/6/16 15:32 ...
- python爬虫:抓取下载电影文件,合并ts文件为完整视频
目标网站:https://www.88ys.cc/vod-play-id-58547-src-1-num-1.html 反贪风暴4 对电影进行分析 我们发现,电影是按片段一点点加载出来的,我们分别抓取 ...
- 合并.ts文件 无需软件
cmd 命令直接输入: copy /b D:\temp\*.ts D:\new.ts D盘temp目录的ts文件 合并 并输出到 D盘 new.ts文件
- 如何合并ts文件?
答: 使用ffmpeg工具,使用方法如下: ffmpeg -i <m3u8 file name> <output file name> 注意:要先将m3u8文件中描述的ts文件 ...
- Linux 下使用 ffmpeg 大批量合并 ts 文件, mp4切割文件为m3u8
见范例 ffmpeg -i "concat:file001.ts|file002.ts|file003.ts|file004.ts......n.ts" -acodec copy ...
- python合并大量ts文件成mp4格式(ps:上限是450,亲测)
import os #exec_str = r'copy /b ts/c9645620628078.ts+ts/c9645620628079.ts ts/1.ts' #os.system(exec_s ...
- 网络视频m3u8解密及ts文件合并
网络视频m3u8解密及ts文件合并 参考了两篇博客: https://blog.csdn.net/weixin_41624645/article/details/95939510 https://bl ...
- 合并ts到mp4
这个比较好用. copy /b d:\xxx\download_ts\* d:\xxx\download_ts\new.mp4 用python ffmpeg也可以,不过我合出来有卡顿或者掉声问题, ...
- 加密的m3u8、ts文件合并
加密后的ts文件不能直接合并或播放,需要使用key对每个ts文件进行解密. 分为两种情况: (1).如果ts文件已经全部下载好,则可以直接在本地通过ffmpeg快速解密合并. (2).如果ts文件没有 ...
随机推荐
- sql server 2008评估期已到的解决办法
点击开始-所有程序-Microsoft SQL Server 2008-配置工具-SQL Server 安装中心然后点击左侧的维护,在点击右侧的版本升级,接着按照提示一直点下一步,到产品密钥的时候输入 ...
- C# 禁止datagridview 自动产生列
dataGridView1.AutoGenerateColumns = false;
- 你应该学会使用的5个ruby方法
今天看到了这篇文章--Five Ruby Methods You Should Be Using,感觉收获颇丰,先简单翻译一下先. 作者写这篇文章的契机是在Exercism上看到了很多ruby代码可以 ...
- SharePoint 2013 启用 以其他用户身份登陆(Sign in as different user)
习惯于SharePoint 2010的用户会发现,SharePoint 2013默认把 以其他用户身份登陆(Sign in as different user)的选项去掉了,这对于开发人员来说很麻烦 ...
- mysql中Table is read only错误解决方法
今天再我把数据库data 拷贝到linux 下运行程序 ”mysql中Table is read only的解决“ 出现这样的问题,查询资料. linux下执行如下命令即可 #mysqladmin - ...
- 关于jquery 取值,赋值常用控件的问题
一.文本框 对于单个文本框: 1.获取文本框: $("#id").val() 2.赋值: $("#id").val("赋值"); 或 (清空 ...
- linux分享二:Linux如何修改字符集
问题: 当在项目中用到服务器端导出并且查询条件中包含汉字时,总是导出失败,Excel中出现null字样,如何解决方法呢? 解决方法: 把linux的字符集改变一下. 路径:etc/sysconfig/ ...
- SpringMVC 封装返回结果对象
/*** *请求返回的最外层对象 **/ public class Result<T>{ /*错误码*/ private Integer code; /*提示信息*/ private St ...
- jQuery学习笔记(简介,选择器)
jQuery优势 1. 强大的选择器.jQuery允许开发者使用从CSS1到CSS3几乎所有的选择器,以及jQuery独创的高级而复杂的选择器. 2. 出色的DOM操作封装 3. 可靠的事件处理机制 ...
- [LintCode] Subarray Sum & Subarray Sum II
Subarray Sum Given an integer array, find a subarray where the sum of numbers is zero. Your code sho ...