When a media file is published, it is typically encoded at different bitrates to accommodate varying bandwidth conditions. Every bitrate version may be sliced into segments. Each segment may be independently downloaded and played by a client. For every bitrate, a server may publish a set of bitrate playlists (e.g., a consecutive list of segments for a given bitrate) and a master playlist (e.g., a list of available bitrate playlists).
During playback, a client may select each consecutive segment based on available bandwidth. This may be done with the goal of maximizing visual quality (i.e., picking the segment with the highest bitrate), while providing an interruption-free experience (i.e., not picking segments that would take too long to download).
Such basic implementations may be well suited for streaming video that is encoded at Constant Bitrate (CBR). However, CBR is not an optimal way to encode video because different types of video scenes have different bandwidth requirements. For example, some sequences may need fewer bits to be encoded, such as sequences that include little motion. Conversely, some sequences need more bits to be encoded, such as in sequences with a lot of motion. Accordingly, various Variable Bitrate (VBR) encoding algorithms have been introduced. The VBR encoding algorithms vary an amount of output data per segment. That is, some segments may have a higher bitrate than other segments.
The media file may be encoded using VBR encoding algorithms based on different constraints. For example, different bitrate ranges may be used as constraints in encoding the video. For a single segment, each bitrate range used with the VBR encoding algorithm may generate an encoded segment at a different bitrate. For example, using a lower bitrate range as a constraint in the VBR encoding algorithm may produce an encoded segment of a lower bitrate than if a higher bitrate range is used.
After encoding using the VBR encoding algorithm, different bitrate playlists are created where each playlist contains segments from the corresponding encoded version of the media file. That is, each bitrate playlist is limited to the encoded segments that were generated using each specific bitrate range.
In one embodiment, a method includes encoding a media file using a variable bitrate encoding algorithm based on a plurality of bitrate ranges to generate a set of encoded segments. For each bitrate range, an encoded segment for each segment of the media file is determined from the set of encoded segments based on a quality level of the encoded segment and each bitrate range. The method then identifies a playlist for each bitrate range including the encoded segment for each segment of the media file that was determined for each bitrate range. At least one playlist includes an encoded segment that was generated based on another bitrate range using the variable bitrate encoding algorithm.
In one embodiment, a non-transitory computer-readable storage medium is provided containing instructions for controlling a computer system to be operable to: encode a media file using a variable bitrate encoding algorithm based on a plurality of bitrate ranges to generate a set of encoded segments; determine, for each bitrate range, an encoded segment for each segment of the media file from the set of encoded segments based on a quality level of the encoded segment and each bitrate range; and identify a playlist for each bitrate range including the encoded segment for each segment of the media file that was determined for each bitrate range, wherein at least one playlist includes an encoded segment that was generated based on another bitrate range using the variable bitrate encoding algorithm.
In one embodiment, an apparatus is provided that includes: one or more computer processors; and a computer-readable storage medium comprising instructions for controlling the one or more computer processors to be operable to: encode a media file using a variable bitrate encoding algorithm based on a plurality of bitrate ranges to generate a set of encoded segments; determine, for each bitrate range, an encoded segment for each segment of the media file from the set of encoded segments based on a quality level of the encoded segment and each bitrate range; and identify a playlist for each bitrate range including the encoded segment for each segment of the media file that was determined for each bitrate range, wherein at least one playlist includes an encoded segment that was generated based on another bitrate range using the variable bitrate encoding algorithm.
The following detailed description and accompanying drawings provide a better understanding of the nature and advantages of the present invention.
Described herein are techniques for a system to provide virtual playlists. In the following description, for purposes of explanation, numerous examples and specific details are set forth in order to provide a thorough understanding of embodiments of the present invention. Particular embodiments as defined by the claims may include some or all of the features in these examples alone or in combination with other features described below, and may further include modifications and equivalents of the features and concepts described herein.
Computing system 102 may communicate or stream media files 108 from a database 106 to clients 104. Clients 104 may present the streamed media file 108 to users that may be using a service, such as a streaming video or audio service. The streamed media file 108 may include a video file (e.g., movie, television show, etc.), audio content, or other content.
Database 106 may include source media files 108-1. Source media files 108-1 may be encoded to produce encoded media files 108-2. When media file 108 is referred to, the term may mean a source media file 108-1, encoded media file 108-2, or both. In one embodiment, encoded media files 108-2 are streamed to clients 104. Encoded media files 108-2 include segments 112 that may be a portion of the media file 108. In selected embodiments, segments 112 may be contained within a database 106 as a unit, distinct from media files 108 from which it originated. Alternatively, each segment 112 may be stored in a collection with other segments 112 (e.g., in a collection with all the other segments 112 corresponding to the same media file 108). For example, an encoded media file 108-2 may simply comprise a sequenced collection of the various segments 112. Computing system 102 may send a sequence of segments 112 to clients 104 when a media file 108 is requested.
A virtual playlist manager 114 provides virtual playlists 116 that are used to determine which segments 112 to send to clients 104. As will be described in more detail below, a variable bitrate (VBR) encoding algorithm may be used to encode source media files 108-1 to generate encoded media files 108-2. The variable bitrate encoding algorithm may use various bitrate constraints, such as constant rate factor (CRF), or another method for keeping video quality constant along with other bitrate constraints, such as video buffer verifier (VBV). In one example, the variable bitrate encoding algorithm uses different bitrate ranges to encode source media file 108-1.
As will be described in more detail below, virtual playlist manager 114 identifies virtual playlists 116 based on a quality level and a bitrate constraint for different virtual playlists 116. For example, various virtual playlists at different bitrate ranges may be offered, such as a high bitrate, an intermediate bitrate, and a low bitrate. The different bitrate ranges are provided to account for different bandwidth availability that may occur when streaming segments 112 to clients 104. For example, when available bandwidth to stream segments 112 to clients 104 is high, then a high bitrate virtual playlist 116 may be used to maximize visual quality. However, when available bandwidth to stream segments 112 to clients 104 is low, then a low bitrate virtual playlist 116 may be used. The low bitrate virtual playlist 116 provides segments 112 of a lower bitrate, which are of a lesser visual quality, but take less time to stream to clients 104. Also, bandwidth (e.g., processing availability) of a server that are serving segments 112 to clients 104 may become constrained. For example, the servers may be experiencing high load at certain times due to a high number of requests. Lower bitrate playlists 116 may be used in this case also even though additional bandwidth with respect to a network to send segments 112 to clients 104 is available, such as when load experienced is above a threshold.
Virtual playlists 116 are virtual in that each virtual playlist 116 may include segments 112 that are from different encoded media files 108-2 using different bitrate ranges. Thus, encoded segments 112 are selected for virtual playlist 116 based on a quality level regardless of the bitrate range in which segments 112 were encoded. For example, the intermediate bitrate virtual playlist 116 may include segments 112 that were generated from a variable bitrate encoding using the high bitrate range. In this case, it is determined the encoded segment 112 generated using the high bitrate range has a higher quality (e.g., higher bitrate) than an encoded segment 112 generated using the intermediate bitrate range. As will be discussed in more detail below, the encoded segment 112 that is generated using the high bitrate range may have a bitrate that falls within the intermediate bitrate range, and thus can be used in the intermediate bitrate virtual playlist 116. To illustrate the concept of virtual playlists 116,
Referring to
In the illustrated graph 202, each segment 112 of media file 108 has been encoded using a VBR encoding algorithm and the highest bitrate range 204a. The resulting encoded segments 112 may be plotted in sequence according to their respective bitrates. The various encoded segments 112 may be sequentially referred to as “A1,” “A2,” “A3,” “A4,” “A5,” and “A6.”
Segments A1 through A6 all have a bitrate less than or equal to the upper limit 206a of the highest range 204a due to using the highest bitrate range 204a as a constraint in the VBR encoding algorithm. While some segments 112 fall within the highest bitrate range 204a, certain segments 112 fall within other bitrate ranges 204 as well. For example, segments A3, A4, and A6 fall within the intermediate bitrate range 204b. Segment A4 also falls within the lowest bitrate range 204c. Accordingly, only a subset of the segments 112 (e.g., segments A1, A2, and A5) may have a bitrate greater than an upper limit 206b of the intermediate bitrate range 204b.
Referring to
Certain encoded segments 112 may be redundant or unnecessary in view of encoded segments 112 generated previously. For example, segments A3, A4, and A6 all fall within the intermediate bitrate range 204b. Moreover, segments A3, A4, and A6 represent a higher quality product than segments B3, B4, and B6 because the bitrate of segments A3, A4, and A6 are higher than segments B3, B4, and B6. As will be discussed below in more detail, encoded segments B3, B4, and B6 may not be stored for future use. Alternatively, knowing that segments A3, A4, and A6 all fall within the intermediate bitrate range 204b, computing system 102 may avoid even generating encoded segments B3, B4, and B6. That is, computing system 102 may encode only the segments corresponding to a necessary subset (e.g., those corresponding to segments A1, A2, and A5) to form segments B1, B2, and B5. Thus, computing system 102 may avoid storing encoded segments B3, B4, and B6, avoid generating encoded segments B3, B4, and B6, or both.
Referring to
Certain encoded segments 112 may be redundant or unnecessary in view of encoded segments 112 generated previously. For example, segment A4 falls within the lowest bitrate range 204c. Moreover, segment A4 represents a higher quality product than segment C4. Accordingly, encoded segment C4 need not be stored for future use. Alternatively, knowing that segment A4 falls within the lowest bitrate range 204c, computing system 102 may avoid even generating encoded segment C4. That is, computing system 102 may encode only the segments corresponding to a necessary subset (e.g., those corresponding to segments A1, A2, A3, A5, and A6) to form segments C1, C2, C3, C5, and C6, and then use previously encoded segment A4. Thus, computing system 102 may avoid storing encoded segment C4, avoid generating encoded segment C4, or both.
Accordingly, in the illustrated graph 202, at least three virtual playlists 116 may be identified based on a quality level. For example, the quality of segments 112 in a bitrate range 204 may be compared to determine the highest quality segment 112 regardless of the bitrate range 204 used to encode each segment 112. A high bitrate virtual playlist 116 (e.g., a playlist 116 suitable for use when the available bandwidth is relatively high) may contain segments A1, A2, A3, A4, A5, and A6. An intermediate bitrate virtual playlist 116 (e.g., a playlist 116 suitable for use when the available bandwidth is at an intermediate level) may contain segments B1, B2, A3, A4, B5, and A6. A low bitrate virtual playlist 116 (e.g., a playlist 116 suitable for use when the available bandwidth is relatively low) may contain segments C1, C2, C3, A4, C5, and C6.
Intermediate bitrate virtual playlist 116 and the low bitrate virtual playlist 116 both include encoded segments 112 of higher than expected quality. That is, both playlists include segments 112 encoded using the highest bitrate range 204a, and these segments 112 have a higher bitrate than corresponding segments 112 that were encoded using the intermediate bitrate range 204b or the low bitrate range 204c. Specifically, the intermediate bitrate virtual playlist 116 includes segments A3, A4, and A6 and the low bitrate virtual playlist 116 include segment A4. Accordingly, the overall quality of the intermediate bitrate virtual playlist 116 and the low bitrate virtual playlist 116 may be improved due to serving higher bitrate segments 112.
At 304, based on the nature of media file 108, nature of typical computer networks, expected variations in bandwidth availability, or the like, multiple bitrate ranges 204 may be identified or defined. In selected embodiments, each bitrate range 204 may correspond to a different bandwidth condition or bandwidth availability and be defined by a different upper bitrate limit 206. For example, a first bitrate range may be the highest range or the range with the highest upper bitrate limit. A second bitrate range may be the next highest range or the range with the next highest upper bitrate limit, and so forth.
At 306, an encoding process may encode media file 108-1 into encoded media file 108-2 for the highest bitrate range using a VBR encoding algorithm. At 308, the encoding process segments encoded media file 108-2 into segments 112
At 310, before the encoding process concludes, virtual playlist manager 114 determines if another bitrate range remains. If another bitrate range remains, the method continues at 312 to identify any segments 112 that do not need to be encoded for the next highest bitrate range. For example, certain segments 112 encoded to fit within highest bitrate range 204a may fall within a lower bitrate range (e.g., an intermediate bitrate range 204b). Accordingly, it may be unnecessarily redundant to again encode those certain segments 112 to fit within any lower bitrate range. For example, referring to
If no additional bitrate ranges 204 remain, the encoding process may terminate, and at 316, the resulting encoded media segments 112 may be stored. In one embodiment, segments 112 are stored in database 106 after encoding of all bitrate ranges 204 (the encoded segments 112 may have been stored in memory as the encoding process is performed). The determination of which segments 112 to store may be based on the quality level. For example, the highest bitrate segment in a bitrange range 204 may be stored and other segments 112 in bitrate range 204 are not stored. Referring to
In other embodiments, certain segments 112 may not be stored. Referring to
Accordingly, segments 112 that do not need to be encoded or stored for the next highest bit range may be determined based on the quality level of previously-encoded segments 112. For example, if a segment 112 is encoded and falls within a lower bitrate range (e.g., the next highest bitrate range), that segment 112 may not be encoded again. This is because the quality of the encoded segment 112 for the higher bitrate range may be higher than the quality of an encoded segment 112 for the next highest bitrate range. Additionally, segments 112 are not stored because higher quality segments 112 have been previously encoded.
After encoding, media files 108 may be requested by clients 104.
At 406, computing system 102 receives a request for a segment 112 at a bitrate range 204. At 408, virtual playlist manager 114 determines a highest quality segment 112 for the bitrate range. For example, virtual playlists 116 are used to determine the highest quality segment 112 based on the requested bitrate range. In one example, if client 104 requests intermediate bitrate range 204b, intermediate virtual playlist 116 includes segments B1, B2, A3, A4, B5, and A6. When the third segment 112 is served, computing system 102 consults virtual playlist 116 for the intermediate virtual playlist 116, and provides segment A4 to client 104.
In one embodiment, virtual playlists 116 are statically generated. Thus, if the intermediate bitrate range is selected, the intermediate bitrate virtual playlist 116 is consulted to determine the segment 112 to serve. In other embodiments, virtual playlist manager 114 may dynamically determine which segment 112 to provide when the request is received. For example, virtual playlist manager 114 may determine a segment 112 that is stored in database 106 that provides the highest quality that meets the bitrate constraint for the intermediate bitrate range 204b (i.e., a segment 112 that has the highest bitrate that is below the intermediate bitrate upper limit 206b). This segment 112 is determined regardless of the bitrate range that was used to encode this segment 112 using the VBR encoding algorithm.
At 410, computing system 102 sends the determined segment 112 to client 104. At 412, computing system 102 determines if the end of media file 108 has been reached. If not, the process reiterates to 406 where another request from client 104 is received at a bitrate range 204. In some cases, the bitrate range requested may change and computing system 102 consults another virtual playlist 116 to determine a segment 112 to serve. If the end of media file 108 is reached, then the process ends.
A server 504 receives requests from clients 104 and serves segments 112 to clients 104. In selected embodiments, server 504 may include a bandwidth module. A bandwidth module may characterize the available bandwidth between server 504 and a client 104. Accordingly, using information provided by a bandwidth module, client 104 may better determine which segments 112 to request from server 504.
Server 504, when responding to a request, may use virtual playlist manager 114 to determine which segment 112 to serve. For example, server 504 consults virtual playlists 116 to determine a segment 112 to serve. In other embodiments, a segment 112 may be dynamically determined. In either case, segment 112 is determined based on a quality level.
Accordingly, higher quality segments 112 may be sent to client 104 based on the bitrate range 204 that is requested. Virtual playlist manager 114 provides segments 112 based on a quality level rather than the bitrate range 204 used to encode segments. Thus, virtual playlists 116 provide the ability to serve higher quality segments 112 by not being constrained by the bitrate range 204 used to encode segments 112. This allows segments 112 that are encoded using a different bitrate range 204 than the bitrate range 204 requested by client 104 may be served to provide higher quality segments 112. Additionally, fewer segments 112 may be stored and/or encoded. When multiple versions of a video need to be encoded (e.g., for a mobile device, for a laptop computer, etc.), the saving of storing and encoding segments 112 may be very useful. Also, the serving of higher quality segments 112 provides a better visual user experience.
Particular embodiments may be implemented in a non-transitory computer-readable storage medium for use by or in connection with the instruction execution system, apparatus, system, or machine. The computer-readable storage medium contains instructions for controlling a computer system to perform a method described by particular embodiments. The instructions, when executed by one or more computer processors, may be operable to perform that which is described in particular embodiments.
As used in the description herein and throughout the claims that follow, “a”, “an”, and “the” includes plural references unless the context clearly dictates otherwise. Also, as used in the description herein and throughout the claims that follow, the meaning of “in” includes “in” and “on” unless the context clearly dictates otherwise.
The above description illustrates various embodiments of the present invention along with examples of how aspects of the present invention may be implemented. The above examples and embodiments should not be deemed to be the only embodiments, and are presented to illustrate the flexibility and advantages of the present invention as defined by the following claims. Based on the above disclosure and the following claims, other arrangements, embodiments, implementations and equivalents may be employed without departing from the scope of the invention as defined by the claims.