ffmpeg ts slices mp4 files and generates m3u8 files

First convert the abc.mp4 file to abc.ts file with ffmpeg:

ffmpeg -y -i abc.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb abc.ts


Then use ffmpeg to slice the abc.ts file and generate the playlist.m3u8 file, one slice in 5 seconds:

ffmpeg -i abc.ts -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 5 abc%03d.ts

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324802383&siteId=291194637