Rearranging the order of ts files in m3u8 causes them to get stuck during playback

I have one m3u8 file and several TS files.

The following is the actual output of the m3u8 file.

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:5
#EXTINF:4.027222,
test0000.ts
#EXTINF:4.004000,
test0001.ts
#EXTINF:4.004000,
test0002.ts
#EXTINF:4.004000,
test0003.ts
#EXT-X-ENDLIST

I rewrote this m3u8 in the following format, saved it, and played it.
Then the playback order of the video was exactly as I changed the m3u8.
However, the video playback does not work as expected and gets stuck.

#extm3u.
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:5
#EXTINF:4.027222,
test0003.ts
#EXTINF:4.004000,
test0002.ts
#EXTINF:4.004000,
test0001.ts
#EXTINF:4.004000,
test0000.ts 
#EXT-X-ENDLIST

If I want to change the order of the TS files like this, how do I edit the m3u8 file?
Or can I use the ffmpeg command to change the order of the ts files and then recreate the m3u8 file?

Answer

Attribution
Source : Link , Question Author : Yuki , Answer Author : Community

Leave a Comment