[FFmpeg-user] hls vs ssegment

Stefano Sabatini stefasab at gmail.com
Wed Jun 5 19:54:30 CEST 2013

On date Wednesday 2013-06-05 09:56:05 +0100, Christian Ebert wrote:
> * Young Kim on Tuesday, June 04, 2013 at 17:33:13 -0700
> > I was looking through the ffmpeg manual for ways of segmenting
> > videos for HLS playback, and it seems like there are two ways.
> > One is to use the hls muxer, while the other is to use
> > ssegment. After a bit of testing, I found that the hls muxer
> > and ssegment do not appear to be different if -"codec copy" is
> > specified after the input. Does anyone happen to know if there
> > is a difference between these two methods?
> I'd be interested in that one too.

hls is specific for HLS and thus is simpler to use in that case.

The segment is more general, has more options, and as a consequence is
more complicated to setup.

> The result of both segmenters seem to work as far as I could
> test.
> The main difference I found is that -f segment outputs floating
> point durations in the segment list:
> #EXTINF:9.005333,
> test-001.ts
> whereas -f hls yields plain integers:
> #EXTINF:10,
> test-001.ts

> With forced keyframes every 10 secs this results in a 
> for -f segment, and
> for -f hls.

The target duration is the *maximum* duration and should be an
integer, segment approximates the duration to the greatest integer M
such that M >= T, while hls just cuts the decimal part.

So if you specify a time of 10 you'll likely get a bigger
targetduration with the segment muxer.

> For the moment I'm using -f hls or -f segment with forced
> keyframes every 9th second(!?) to obtain the target duration of
> 10.
> What difference does that make in practice?

In practice players should be robust enough and be able to play the
m3u8 regardless the chosen approximation, but segment should be more
compliant to a strict interpretation of the M3U8 specification.


More information about the ffmpeg-user mailing list