合并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文件的更多相关文章

  1. python爬虫:抓取下载视频文件,合并ts文件为完整视频

    1.获取m3u8文件 2.代码 """@author :Eric-chen@contact :sygcrjgx@163.com@time :2019/6/16 15:32 ...

  2. python爬虫:抓取下载电影文件,合并ts文件为完整视频

    目标网站:https://www.88ys.cc/vod-play-id-58547-src-1-num-1.html 反贪风暴4 对电影进行分析 我们发现,电影是按片段一点点加载出来的,我们分别抓取 ...

  3. 合并.ts文件 无需软件

    cmd 命令直接输入: copy /b D:\temp\*.ts D:\new.ts D盘temp目录的ts文件 合并 并输出到 D盘 new.ts文件

  4. 如何合并ts文件?

    答: 使用ffmpeg工具,使用方法如下: ffmpeg -i <m3u8 file name> <output file name> 注意:要先将m3u8文件中描述的ts文件 ...

  5. Linux 下使用 ffmpeg 大批量合并 ts 文件, mp4切割文件为m3u8

    见范例 ffmpeg -i "concat:file001.ts|file002.ts|file003.ts|file004.ts......n.ts" -acodec copy ...

  6. 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 ...

  7. 网络视频m3u8解密及ts文件合并

    网络视频m3u8解密及ts文件合并 参考了两篇博客: https://blog.csdn.net/weixin_41624645/article/details/95939510 https://bl ...

  8. 合并ts到mp4

    这个比较好用. copy /b d:\xxx\download_ts\*   d:\xxx\download_ts\new.mp4 用python ffmpeg也可以,不过我合出来有卡顿或者掉声问题, ...

  9. 加密的m3u8、ts文件合并

    加密后的ts文件不能直接合并或播放,需要使用key对每个ts文件进行解密. 分为两种情况: (1).如果ts文件已经全部下载好,则可以直接在本地通过ffmpeg快速解密合并. (2).如果ts文件没有 ...

随机推荐

  1. label 赋值 , 隐藏 , 显示

    <label name='by_stages_number' id='by_stages_number'></label> document.getElementById(&q ...

  2. HTML <video> 标签

    http://www.w3school.com.cn/tags/tag_video.asp <%@ Page Language="VB" AutoEventWireup=&q ...

  3. appium简明教程(1)——appium和它的哲学世界

    什么是appium? 本文已经迁移到测试教程网,后续更新会在测试教程网更新. 下面这段介绍来自于appium的官网. Appium is an open-source tool you can use ...

  4. shell脚本监控Linux系统的登录情况

    一.登录日志记录 vi /etc/profile 在最后面添加一行: echo "`who`" > /var/log/login.log 二.监控日志文件 #!/bin/ba ...

  5. winform中键盘和鼠标事件的捕捉和重写

    在编写winform应用程序时,有时需要无论在哪个控件获取焦点时,对某一个键盘输入或者鼠标事件都进行同样的操作.比如编写一个处理图片的应用程序时,希望无论当前哪个控件获得焦点,当用户按上.下.左.右键 ...

  6. 安装windows后grub修复

    安装windows之后发现ubuntu进不去了,主要原因在于grub被windows干掉了. 原本希望通过使用u盘来进行修复,结果U盘不被识别. 于是通过easybcd启动ubunt live光盘.进 ...

  7. vs 2017打包安装包(印象深刻)

    Visual Studio Install 打包安装项目2017 以下是具体步骤 一.安装环境 1.下载:链接地址 2.安装vs2017的时候需要安装依赖 .NET framework 4.6 .下载 ...

  8. IOS团队开发之——CocoaPods 第三方库管理工具

    使用前需要下载ruby 的gem 命令镜像,mac 下自带有.但一般不用,直接访问国外网站有限制. 下面安装 http://ruby.taobao.org/ http://blog.devtang.c ...

  9. Vue2.0 v-for 中 :key 的作用

  10. 每日英语:What You Like Best: Shopping, Food and Tech

    In a year that featured one of history's biggest corporate buyouts, a stock-market surge reminiscent ...