1

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?

2
  • 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?
    – Gyan
    Apr 21 '16 at 9:31
  • 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. Apr 21 '16 at 11:41
-2

Try inserting EXT-X-DISCONTINUITY between those splitted ts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.