title: MPEG-TS Segments HTTP Live Streaming
body: <p>I'm trying to interleave MPEG-TS segments but failing. One set of segments was actually captured using the built in camera in the laptop, then encoded using FFMPEG with the following command:</p>
  
  <pre><code>ffmpeg -er 4 -y -f video4linux2 -s 640x480 -r 30 -i %s -isync -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -fflags +genpts -b 386k -coder 0 -me_range 16 -keyint_min 25 -i_qfactor 0.71 -bt 386k -maxrate 386k -bufsize 386k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 640:480
  </code></pre>
  
  <p>And the other one is an avi file that was encoded using the following command:</p>
  
  <pre><code>fmpeg -er 4 -y -f avi -s 640x480 -r 30 -i ./DSCF2021.AVI -vbsf dump_extra -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -fflags +genpts -b 386k -coder 0 -me_range 16 -keyint_min 25 -i_qfactor 0.71 -bt 386k -maxrate 386k -bufsize 386k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 640:480
  </code></pre>
  
  <p>Then the output is segmented into ts segments using an open source segmenter.</p>
  
  <p>If both come from the same source (both from the camera) they work fine. However in this case, the second set of segments freeze. Time passes, but the video does not move..
  So i think it's an encoding problem. So my question is, how should i change the ffmpeg command for this to work?</p>
  
  <p>By interleave I mean, having a playlist with the first set of segments, and another playlist with the other set of segments, and having the client call one then the other (HTTP Live Streaming)</p>
  
  <p>The ffprobe output of one of the first set of segments: </p>
  
  <pre><code>Input #0, mpegts, from 'live1.ts':
    Duration: 00:00:09.76, start: 1.400000, bitrate: 281 kb/s
    Program 1 Service01
      Metadata:
        name            : Service01
        provider_name   : FFmpeg
      Stream #0.0[0x100]: Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 29.92 fps, 29.92 tbr, 90k tbn, 59.83 tbc
      Stream #0.1[0x101]: Audio: aac, 48000 Hz, stereo, s16, 111 kb/s
  </code></pre>
  
  <p>The ffprobe output of one of the second set of segments:</p>
  
  <pre><code>Input #0, mpegts, from 'ad1.ts':
    Duration: 00:00:09.64, start: 1.400000, bitrate: 578 kb/s
    Program 1 Service01
      Metadata:
        name            : Service01
        provider_name   : FFmpeg
      Stream #0.0[0x100]: Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
      Stream #0.1[0x101]: Audio: aac, 48000 Hz, stereo, s16, 22 kb/s
  </code></pre>
  
  <p>Thank you,</p>