分享

使用 ffmpeg 进行视频(ts)合并

 rongq2007 2021-07-04

在这里插入图片描述

背景

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

方法

方法一:

1.新建file.txt文档

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'

1

2

3

4

5

6

7

8

9

10

2.执行ffmpeg命令

# -safe 0: 防止Operation not permitted

ffmpeg.exe -f concat -safe 0 -i file.txt -c copy out.mp4

1

2

方法二:

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

ffmpeg -i "concat:34020000001310000701_live-16.ts|34020000001310000701_live-17.ts|" -c copy output.mp4

————————————————

版权声明:本文为CSDN博主「TSINGEYE」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/jiuaiwo1314/article/details/106100781

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多