ffmpeg 切割mp4为m3u8格式

2021/2/27 1:36:44ffmpegffmpeg
ffmpeg -i raw_video.mp4 -c copy -map 0 -f segment -segment_list hls/video.m3u8 hls/video%d.ts
ffmpeg -i Video.mp4 -c copy -map 0 -f segment -segment_list video_playlist.m3u8 -segment_time 2 video%03d.ts
ffmpeg -i Video.mp4 -c copy -bsf:v h264_mp4toannexb -map 0 -f segment -segment_time 10 -segment_format mpegts  -segment_list video_playlist.m3u8  video%03d.ts
ffmpeg -i test.mp4 -codec:v libx264 -codec:a mp3 -map 0 -f ssegment -segment_format mpegts -segment_list playlist.m3u8 -segment_time 10 out%03d.ts

segment_time参数指定切片的时间(大小),效果上感觉不加这个参数,使用系统默认的时间大小就挺好

官方文档:https://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment/