ffmpeg 文件切片合并

最近再做m3u8切片合并下载的小功能,因为要合并成mp4,所以考虑用ffmpeg来搞,mp4格式忒复杂了。
查了下文档ffmpeg支持concat demux和concat protocol.
用法如下:
ffmpeg -i “concat:input1.mpg|input2.mpg|input3.mpg” -c copy output.mpg //这个是concat protocal,这个命令只支持一部分视频格式 如mpeg1,2 mpegts,不支持flv,mp4

mylist.txt:

this is a comment

file ‘/path/to/file1’
file ‘/path/to/file2’
file ‘/path/to/file3’

ffmpeg -f concat -i mylist.txt -c copy output //这个是运用concat demux,和前面的命令有些不同,这个会把demux文件然后re-encode切片文件,所以只要ffmpeg支持的格式,这个命令都管用。

开始觉得这俩个命令功能是一样的。实验了第一个命令 flv不管用,只输出了第一片的flv。查了下官方文档找到这一段:

The flv container format doesn’t support file-level concatenation; only a
few container file types do. So the concat protocol won’t work on them.

The concat demuxer, as its name suggests, demuxes the input streams from
their container and then concatenates them, so it doesn’t care about what
the input container is (and if the codecs are all the same w/ similar
characteristics, you can actually concatenate files of different container
formats).

参考:How to concatenate (join, merge) media files
ffmpeg wiki

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值