Answers.Body: <p>Try inserting EXT-X-DISCONTINUITY between those splitted ts</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-14T18:58:03.927Z
Answers.LastActivityDate: 2016-08-14T18:58:03.927Z
Answers.UserDisplayName: mustafa.yalniz
Body: <p>I am currently using ffmpeg to segment/transcode a longer transport stream into HLS with 10s segments. Now I want to grab the second segment from the following section:</p>
  
  <pre><code>#EXTINF:10.041667,
  bbb_fhd_50s_000.ts
  #EXTINF:10.041667,
  bbb_fhd_50s_001.ts
  #EXTINF:9.666667,
  bbb_fhd_50s_002.ts
  </code></pre>
  
  <p>and split that into two chunks at 3s, result would look like:</p>
  
  <pre><code>#EXTINF:10.041667,
  bbb_fhd_50s_000.ts
  #EXTINF:3.008000,
  bbb_fhd_50s_001_cut1.ts
  #EXTINF:7.104000,
  bbb_fhd_50s_001_cut2.ts
  #EXTINF:9.666667,
  bbb_fhd_50s_002.ts
  </code></pre>
  
  <p>Now, I got this to work using the following commands:</p>
  
  <pre><code>ffmpeg -i bbb_fhd_50s_001.ts -ss 00:00:00.0 -c copy -t 00:00:03.0 bbb_fhd_50s_001_cut1.ts
  ffmpeg -i bbb_fhd_50s_001.ts -ss 00:00:03.0 -c copy bbb_fhd_50s_001_cut2.ts
  ffprobe -v error -show_entries format=duration   -of default=noprint_wrappers=1:nokey=1 -sexagesimal bbb_fhd_50s_001_cut1.ts
  ffprobe -v error -show_entries format=duration   -of default=noprint_wrappers=1:nokey=1 -sexagesimal bbb_fhd_50s_001_cut2.ts 
  </code></pre>
  
  <p>Now when playing back the new m3u8 the transition between bbb_fhd_50s_000.ts and bbb_fhd_50s_001_cut1.ts works smoothly, but the transition back to the next uncut segment does not (from bbb_fhd_50s_001_cut2.ts to bbb_fhd_50s_002.ts). The video hangs for a couple of seconds after bbb_fhd_50s_001_cut2.ts has finished after which it continues. If I run the following sequence it works fine as well:</p>
  
  <pre><code>#EXTINF:10.041667,
  bbb_fhd_50s_000.ts
  #EXTINF:9.666667,
  bbb_fhd_50s_002.ts
  </code></pre>
  
  <p>Anyone got any idea what goes wrong at the ending of bbb_fhd_50s_001_cut2.ts, and how to cut it correctly?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-21T09:31:12.993Z
Comments.Text: What's the start_time and duration of both the audio/video streams for cut2 and the next segment? Is the transition between the two cut segments smooth?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-21T11:41:45.377Z
Comments.Text: Yes, the transition between the two cut segments is smooth. I've done additional testing on it and now it kinda looks like the problem is that bbb_fhd_50s_002.ts doesn't start with a keyframe. This is a bit confusing for me though considering you can put bbb_fhd_50s_002.ts as the first segment and it will work.
Comments.UserDisplayName: staffan.nase
Tags: <ffmpeg>
Title: Split HLS TS segment at specific timestamp
UserDisplayName: staffan.nase
ThreadText: # Split HLS TS segment at specific timestamp
  
  (Asked by: username_0 on 2016-04-21)
  
  I am currently using ffmpeg to segment/transcode a longer transport stream into HLS with 10s segments. Now I want to grab the second segment from the following section:
  
  ```
  #EXTINF:10.041667,
  bbb_fhd_50s_000.ts
  #EXTINF:10.041667,
  bbb_fhd_50s_001.ts
  #EXTINF:9.666667,
  bbb_fhd_50s_002.ts
  
  ```
  
  and split that into two chunks at 3s, result would look like:
  
  ```
  #EXTINF:10.041667,
  bbb_fhd_50s_000.ts
  #EXTINF:3.008000,
  bbb_fhd_50s_001_cut1.ts
  #EXTINF:7.104000,
  bbb_fhd_50s_001_cut2.ts
  #EXTINF:9.666667,
  bbb_fhd_50s_002.ts
  
  ```
  
  Now, I got this to work using the following commands:
  
  ```
  ffmpeg -i bbb_fhd_50s_001.ts -ss 00:00:00.0 -c copy -t 00:00:03.0 bbb_fhd_50s_001_cut1.ts
  ffmpeg -i bbb_fhd_50s_001.ts -ss 00:00:03.0 -c copy bbb_fhd_50s_001_cut2.ts
  ffprobe -v error -show_entries format=duration   -of default=noprint_wrappers=1:nokey=1 -sexagesimal bbb_fhd_50s_001_cut1.ts
  ffprobe -v error -show_entries format=duration   -of default=noprint_wrappers=1:nokey=1 -sexagesimal bbb_fhd_50s_001_cut2.ts 
  
  ```
  
  Now when playing back the new m3u8 the transition between bbb\_fhd\_50s\_000.ts and bbb\_fhd\_50s\_001\_cut1.ts works smoothly, but the transition back to the next uncut segment does not (from bbb\_fhd\_50s\_001\_cut2.ts to bbb\_fhd\_50s\_002.ts). The video hangs for a couple of seconds after bbb\_fhd\_50s\_001\_cut2.ts has finished after which it continues. If I run the following sequence it works fine as well:
  
  ```
  #EXTINF:10.041667,
  bbb_fhd_50s_000.ts
  #EXTINF:9.666667,
  bbb_fhd_50s_002.ts
  
  ```
  
  Anyone got any idea what goes wrong at the ending of bbb\_fhd\_50s\_001\_cut2.ts, and how to cut it correctly?
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: What's the start_time and duration of both the audio/video streams for cut2 and the next segment? Is the transition between the two cut segments smooth?  
  > **username_0**: Yes, the transition between the two cut segments is smooth. I've done additional testing on it and now it kinda looks like the problem is that bbb_fhd_50s_002.ts doesn't start with a keyframe. This is a bit confusing for me though considering you can put bbb_fhd_50s_002.ts as the first segment and it will work.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-08-14. Score: -2
  
  Try inserting EXT-X-DISCONTINUITY between those splitted ts
  
  
  ---
  
  