前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >FFmpeg合并多个ts视频文件

FFmpeg合并多个ts视频文件

作者头像
TSINGEYE清眸物联
发布2023-01-04 14:45:31
2K0
发布2023-01-04 14:45:31
举报

背景

现在很多流媒体支持了hls保存录像,那么下载录像需要怎么支持呢?有人使用了ffmpeg 拉取hls流进行转码保存,这样太耗时,现提供一种节省时间、消耗更低方法。

方法

方法一:

1.新建file.txt文档

代码语言:javascript
复制
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-16.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-17.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-18.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-19.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-20.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-21.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-22.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-23.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-24.ts'
file 'F:\Release\StreamMediaServer\html\hd\34020000001310000701\34020000001310000701_live-25.ts'

2.执行ffmpeg命令

代码语言:javascript
复制
# -safe 0: 防止Operation not permitted
ffmpeg.exe -f concat -safe 0 -i file.txt -c copy out.mp4

方法二:

直接写ffmpeg命令,通过“|”来分隔文件名

代码语言:javascript
复制
ffmpeg -i "concat:34020000001310000701_live-16.ts|34020000001310000701_live-17.ts|" -c copy output.mp4
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-05-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 背景
  • 方法
    • 方法一:
      • 方法二:
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档