解决:
视频源文件->.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的才成功,所以应该还是配置没配对,还是太菜了