StrikeTracker KnowledgeBase

Pseudostreaming

Videos are often delivered through the CDN using a method called 'progressive download', which enables playing of the video as it progressively downloads in the background. Pseudostreaming is supported through the CDN, providing the capability to seek to portions of the video that may not yet be downloaded and also throttle the bandwidth if desired. Using the right combinations of range requests and Bandwidth Throttling, progressively downloaded videos can behave and look the same as truly streamed videos, often the end user can not tell the difference.

Note that the CDN supports range requests to the HTTP specification here:


http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Jump-to-Time

For H.264-encoded videos, the Highwinds CDN natively supports a "jump-to-time" feature on the CDS platform, allowing you to seek to a portion of the video that may not yet be downloaded. Simply add a URL parameter named "start" and a timestamp (in seconds), and the CDN will deliver the stream from that point forward. The "start" parameter is used by default for Jump-to-Time functionality, however that parameter name is configurable on the CDN. In many instances, FLVs with enhanced metadata also support this Jump-to-Time functionality.

When using the jump-to-time for videos such as .MP4, there is often a "moov" atom that contains necessary metadata about the video. For fast seeking to portions of the video that have not yet been downloaded, this "moov" atom will need to be present at the beginning of the video rather than the end. Tools are available to reposition the "moov" atom within an existing video.

Jump-to-Byte

Some types of videos (such as metadata-enhanced FLVs) can be enabled with progressive seek functionality via the "jump-to-byte" approach. When using Jump-to-Byte, there are two query string parameters than can be utilized. The "ib" query string parameter is used to specify the initial bytes of a video that should be returned before sending the requested byte offset. The "fs" query string parameter is used to specify the specific byte offset into the requested video. The parameter names "ib" and "fs" are used by default on the CDN, however these names are configurable.

In order for this jump-to-byte process to work, your FLVs must have metadata within them (specifically the “keyframes” element). If they don’t today, download FLVMDI of FFMPEG and run it against each of your files with the /k switch (this will inject the keyframe metadata): http://www.buraks.com/flvmdi

If you already have the metadata needed for each video, then you should have an xml file that has a list of file positions and time codes for all of the keyframes in the video. You basically need to have is a mapping between times and the keyframes that are the closest to those times. This is accomplished by mapping the time indexes in the “times” array to the keyframe indexes in the “filepositions” array. Both of these arrays are found on the “keyframes” metadata element.

Note that there are a few ways to accomplish this:

1) You can do it all in the player:

  1. Initially load the file from the beginning, which will cause the "onMetaData" handler to fire as soon as the metadata is read from the file's header.
  2. Within the onMetaData handler, load the time indexes and keyframe file positions into a lookup table.
  3. When a scrubbing event occurs, use the lookup table to find the file position of the keyframe that most closely matches the time index that you passed in.
  4. Re-request the file with the “ib=13&fs=<keyframe>” parameters.
 

Note: Leave the ib=13 on for all requests (both the "ib" and "fs" parameters are optional for the initial request).

2) You can do it all on the server:

  1. Run FLVMDI with both the /k and the /x switch, which will output an XML file containing all of the keyframe data.
  2. Import the keyframe file positions and the times (there should be the same number of elements in each array) into your database.
  3. When a scrubbing event occurs for non-downloaded portions of the file, make a call back to the server for the new "fs" parameter values.
  4. Write a simple server-side web service call that finds the closest keyframe to the time index that you are looking for, and returns it when called.
  5. Re-request the file with the “ib=13&fs=<keyframe>” parameters.

3) Or you can perform a hybrid of the two:

  1. Run FLVMDI with both the /k and the /x switch, which will output an XML file containing all of the keyframe data.
  2. Import the keyframe file positions and the times (there should be the same number of elements in each array) into your database.
  3. When generating the player page for the selected video, include data in the page itself that will allow the player to do the lookup without needing to build the index using information from the onMetaData event.
  4. When a scrubbing event occurs, use the lookup table to find the file position of the keyframe that most closely matches the time index that you passed in.
  5. Re-request the file with the “ib=13&fs=<keyframe>” parameters.
Field Default Parameter Description
Jump-to-Byte Initial Bytes Parameter ib This is the name of the query string parameter that indicates to the CDN the initial bytes of a video that should be returned before sending the requested byte offset. This parameter is part of the jump-to-byte feature that is initiated on a per request basis.
Jump-to-Byte Offset Parameter fs This is the name of the query string parameter that indicates to the CDN the specific offset into the video that is being requested. This parameter is part of the jump-to-byte feature that is initiated on a per request basis.
Jump-to-Time End Parameter end This is the name of the query string parameter that indicates to the CDN the end time offset of the video that should be returned. This parameter is part of the jump-to-time feature that is initiated on a per request basis.
Jump-to-Time Start Parameter start This is the name of the query string parameter that indicates to the CDN the start time offset of the video returned. This parameter is part of the jump-to-time feature that is initiated on a per request basis.
Bandwidth Throttling Initial Burst Parameter ri This is the name of the query string parameter that indicates to the CDN an initial burst rate to use when delivering a file. This parameter is part of the bandwidth limiting feature that is initiated on a per request basis.

Specifies a value in bytes that should run at full speed before an "rs" parameter takes effect.
Bandwidth Throttling Sustained Rate Parameter rs This is the name of the query string parameter that indicates to the CDN the sustained rate being requested for the delivery of a file. This parameter is part of the bandwidth throttling feature that is initiated on a per request basis.

Specifies a value in kilobits per second at which the transfer should run at that rate sustained. This can be used with progressive download delivery to keep the player from getting too far ahead of what the end user is actually viewing.