ffmpeg视频切片遇到的问题

解决:

视频源文件->.mp4文件->.ts文件->.m3u8和.ts分片

部署ffmpeg-git-amd64-static.tar.xz

测试命令

ffmpeg -i /mydata/jar/res/3.avi /mydata/jar/res/index.mp4

ffmpeg -y -i /mydata/jar/res/index.mp4  -vcodec copy -acodec copy -vbsf h264_mp4toannexb /mydata/jar/res/index.ts

ffmpeg -i /mydata/jar/res/index.ts -c copy -map 0 -f segment -segment_list /mydata/jar/res/index.u3m8 -segment_time 30 /mydata/jar/res/index_%%4d.ts

过程:

.ts转换为.m3u8和.ts分片,报错:

Invalid data found when processing input

发现是上一步,视频源文件转换.ts文件出错,报错:

Codec 'mpeg4' (12) is not supported by the bit stream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27)

然后,将视频源文件统一转换为.mp4文件,再将.mp4文件转换.ts文件:

Windows部署,视频源文件->.mp4文件->.ts文件->.m3u8和.ts分片成功,但是云服务器linux 依旧报错:

Codec 'mpeg4' (12) is not supported by the bit stream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27)

此时,云服务器linux上ffmpeg是6.0版本,猜测是configraution没配置对,尝试修改,没用,改用4.4版本,没用

后面,部署ffmpeg-git-amd64-static.tar.xz的才成功,所以应该还是配置没配对,还是太菜了

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值