Search code examples
iosmpmovieplayercontrollerhttp-live-streaming

Why does MPMoviePlayerController report wrong timestamp after seeking a HTTP Live stream


I generate a VOD stream using mediafilesegmenter

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:9.9683,   
spider0.ts
...
#EXTINF:4.2122,   
spider473.ts
#EXT-X-ENDLIST

I check the timestamp reported by player but it report the wrong timestamp (player shows different video frame comparing with original video) after i seek. I use player provided by iOS without any customization

What is the problem?


Solution

  • HLS doesn't allows accurate seek due to few features in preparation of video.

    Specification - https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-05

    First, the length of the file may differ from the original. Second, the length of the chunks may also differ. That's why there is a difference in the frames in HLS and original file. HLS (Apple's HTTP Live Streaming) use H.264 video - there is no transcoding involved, only a simple dynamic repackaging to convert between formats.

    At the same time seek is not working correctly, and only within a chunk, if seek outside chunk we will go to the beginning of a new chunk. I encounter such a problem on FMS and Wowza and not corrected it.