24/06/2024: [Presentation of the problem]
I had dowloaded some videos from the Internet, few years ago.
I obtained many files:
- a series of files in
.ts
- a single file
playlist.m3u8
In my example:
A series of 318 files named from segment1_1_av.ts
to segment318_1_av.ts
I try to merge the series of .ts
files, with this command-line of Powershell:
ffmpeg -i playlist.m3u8 -c copy out.ts
It seems to fail due to what is written in playlist.m3u8
When I edit (with Notepad) playlist.m3u8
, I obtain :
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment1_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment2_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment3_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment4_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment5_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment6_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment7_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment8_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment9_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment10_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment11_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment12_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment13_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment14_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment15_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment16_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment17_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment18_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment19_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment20_1_av.ts
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment21_1_av.ts
[…]
#EXTINF:10.000,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment317_1_av.ts
#EXTINF:6.520,
http://arteptweb-vh.akamaihd.net/i/am/ptweb/069000/069800/069809-001-A_0_VOF_AMM-PTWEB_XQ.seC11KAAU2.smil/segment318_1_av.ts
#EXT-X-ENDLIST
I don't know what to modify in playlist.m3u8
.
Could you tell me what a correct playlist.m3u8
should contain, or should look like?
So I will be able to manually correct the playlist.m3u8
that I have.
NB: The .ts
files are all on my hard drive (they are not on http://arteptweb-vh.akamaihd.net, Internet adress which is obsolete today).
PS: I use Win 10.
26/06/2024:
I have followed the advices of JayCravens (to begin with his second method, because it is less abstract for me…):
- I renamed my playlist.m3u8 file to playlist.m3u
- I modified the content of playlist.m3u:
#EXTM3U #EXT-X-PLAYLIST-TYPE:EVENT #EXT-X-VERSION:4 #EXT-X-MEDIA-SEQUENCE:1 #EXTINF:10.00, segment1_1_av.ts
// List of files 2 and 317 go here.
#EXTINF:6.520, segment318_1_av.ts #EXT-X-ENDLIST
NB : I only have let (I don't know if I have been wright?):
#EXTINF:6.520, segment318_1_av.ts #EXT-X-ENDLIST
in stade of #EXTINF:10, segment318_1_av.ts
- To finish : ffmpeg -i playlist.m3u -codec copy output.mkv
→ The result: I obtain an output.mkv file. When I play (with VLC) this output.mkv file : I have fastly review it, and it seems to me perfect…
However, I noted two things written in red, with Powershell:
[NULL @ 000002c0bd2bad40] non-existing SPS 0 referenced in buffering period
[h264 @ 000002c0bd29c0c0] non-existing SPS 0 referenced in buffering period
Source : From m3u8/ts files to mp4
#EXTINF:6.520, segment318_1_av.ts
for it to work?#EXTINF:
value can be > or = to. I updated the answer to include#EXT-X-ENDLIST
. Good stuff!