[FFmpeg-devel] Seeking in Apple HTTP Live Streaming

Michael Niedermayer michaelni at gmx.at
Mon Nov 21 20:34:35 CET 2011

On Mon, Nov 21, 2011 at 08:21:28AM -0800, Takis Issaris wrote:
> Hi all,
> As a follow-up to my previous patch, I'd like to implement more exact seeking on HTTP Live Streams. Currently, when seeking to a specific timestamp in such a stream, the seeking results in arriving at the start of the correct segment, but not at the requested timestamp within that segment. Worse, when seeking to a specific timestamp which happens to be a part of the segment which is currently being played, the playback resets to the start of the current timestamp (that could most likely be fixed rather easily). So, when pressing forward arrow key when using ffplay, you'll actually move backwards to the start of the segment (if current timestamp+10s lies within the current segment).
> I'd like to change that so that the applehttp.c seeking implementation uses mpegts.c to actually seek to the specified timestamp, but I'm not sure on how to implement this.
> Currently, when seeking using applehttp_read_seek, I think there's no valid MPEG-TS demuxer context in that function. Should I make sure I get a valid demuxer there, or should I defer the actual seeking using the MPEG-TS demuxer until a valid demuxer is constructed elsewhere in the applehttp.c file?

I assume theres no way to tell the server to start a segment from a
specific time? (i havnt found one)

Do the servers support seeking to a specific byte position within a
segment ?
If yes, seeking per CBR assumption is an option which also doesnt need
the demuxer
The reason why i suggect to assume CBR is that the alternative is
the default seek per timestamp which does a binary search and this
could be quite slow with http needing to send a few packets back and
forth for each iteration of the search

depending on network speed, bitrate and segment size a linear search
could also be considered, that is demux and throw away packets until
the right time, this may or may not be faster than a binary search

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111121/3d236418/attachment.asc>

More information about the ffmpeg-devel mailing list