4

I'm using FFMPEG and a free segmenter (Carson Mcdonald's) to produce my ts segments which i later save to a web server and play with Quicktime by playing the .m3u8

If I have segments 1,2,3,4 and another stream with segments 1,2,3,4 and would like to interleave them what should I do. If i do as follows: 1,2, other stream's 3, 4 It works fine. However, If i want to do as follows: 1,2, other stream's 4, 4 it doesn't work.

In other words the segment to be added must have the same number as the one I'm replacing. Why is that? Does it have to do with PCR? I would like to be able to interleave any segment anywhere.. How can I do that?

Thank you,

The M3U8 file is

#EXTM3U 
#EXT-X-TARGETDURATION:10 
#EXT-X-MEDIA-SEQUENCE:21 
#EXTINF:10, sample_ep_386k-00021.ts 
#EXTINF:10, media_2.ts 
#EXTINF:10, sample_ep_386k-00023.ts
TheJuice
  • 4,434
  • 2
  • 26
  • 36
user1069624
  • 561
  • 2
  • 9
  • 24
  • Could you post the M3U8 file? – TheJuice Dec 07 '11 at 15:39
  • As an experiment, if you cat the files together, e.g. 'cat 1 2 other4 4 > test.ts', can you play that video back in VLC? – TheJuice Dec 07 '11 at 16:08
  • Could you elaborate on "it doesn't work"? What behaviour do you see? – TheJuice Dec 07 '11 at 16:51
  • @TheJuice I mean it plays sample_ep_386k-00021 then when it goes to the segment of the other stream (media_2) it freezes, then jumps and goes to the segment after that (sample.. 23)... so it doesn't even play it. But IF media_2 was actually segment 22 in the other stream.. it plays fine! – user1069624 Dec 07 '11 at 17:11
  • @TheJuice When I concatenate the files as you suggested, they play normally with VLC... I feel the problem is when i play them with the playlist file on the spot without concatenation. – user1069624 Dec 07 '11 at 17:16

2 Answers2

0

Have you modified the .M3U8 playlist (index) file to point to the two 4 files? I assume they are at distinct locations on the server.

TheJuice
  • 4,434
  • 2
  • 26
  • 36
  • Yes I modified it to include locations of new segments. At the moment I'm keeping them at the same location for simplicity. This is the playlist file: `#EXTM3U #EXT-X-TARGETDURATION:10 #EXT-X-MEDIA-SEQUENCE:21 #EXTINF:10, sample_ep_386k-00021.ts #EXTINF:10, media_2.ts #EXTINF:10, sample_ep_386k-00023.ts` where media_2 is from the other stream, segment number 2. – user1069624 Dec 07 '11 at 15:53
  • Just to be clear if media_2 was even sample_ep_386k-00003 or any segment in the same stream but a different segment number.. it also doesn't work. – user1069624 Dec 08 '11 at 07:59
  • 1
    I found a way around my original problem. Thank you. – user1069624 Dec 13 '11 at 11:12
  • @tommychheng I'm sorry I don't quite remember because it was a while back.. but I believe that instead of editing the current playlist file, I used to point to another one with the segments I want to interleave, and then point back to this one when it's done... – user1069624 Oct 07 '13 at 10:03
0

This is one of the common problem faced by many in SO.

See my answer here: MPEG-TS Segments HTTP Live Streaming

things to check out :

o PCR (timestamp) discontinuity
o Matching framerate
o file format
o number and type of tracks
o encoding parameters
o encoding sequence

Community
  • 1
  • 1
Dipan Mehta
  • 2,110
  • 1
  • 17
  • 31